summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2005-05-19 20:38:48 +0200
committermsvensson@neptunus.(none) <>2005-05-19 20:38:48 +0200
commit920c16c055cfb1a5c1a5fe95373cc9c432eb17fd (patch)
tree6ceb697d9663c57ba7137b9a23006ada29920e9e /ndb
parenta996abc594349b5590e22c5d3122881a9ec3456e (diff)
downloadmariadb-git-920c16c055cfb1a5c1a5fe95373cc9c432eb17fd.tar.gz
BUG#9626 valgrind warnings
- after review fixes
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp3
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp13
2 files changed, 11 insertions, 5 deletions
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
index 18d1ec76a3c..43af6749a85 100644
--- a/ndb/include/transporter/TransporterDefinitions.hpp
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -45,8 +45,9 @@ enum SendStatus {
* Protocol6 Header +
* (optional signal id) + (optional checksum) + (signal data)
*/
+const Uint32 MAX_SECTION_SIZE= 4096;
//const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25));
-const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*4096);
+const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*MAX_SECTION_SIZE);
/**
* TransporterConfiguration
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index a4e96440cd1..fe2df815f1f 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1088,6 +1088,7 @@ NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
Send GET_TABINFOREQ signal with the table name in the first
long section part
*/
+
NdbTableImpl *
NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
{
@@ -1095,12 +1096,16 @@ NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
GetTabInfoReq* const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
const Uint32 str_len= strlen(name) + 1; // NULL terminated
+ const Uint32 str_len_words= (str_len + 3) / 4; // Size in words
- /* Note! It might be a good idea to check that the length of
- table name does not exceed the max size of a long signal */
+ if (str_len > MAX_SECTION_SIZE)
+ {
+ m_error.code= 4307;
+ return 0;
+ }
m_namebuf.clear();
- m_namebuf.grow(str_len+(4-str_len%4)); // Round up to word size
+ m_namebuf.grow(str_len_words*4); // Word size aligned number of bytes
m_namebuf.append(name, str_len);
req->senderRef= m_reference;
@@ -1114,7 +1119,7 @@ NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
LinearSectionPtr ptr[1];
ptr[0].p= (Uint32*)m_namebuf.get_data();
- ptr[0].sz= (str_len + 3)/ 4; // Size in words
+ ptr[0].sz= str_len_words;
return getTable(&tSignal, ptr, 1, fullyQualifiedNames);
}