=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp' --- storage/ndb/include/ndbapi/Ndb.hpp 2009-12-03 09:48:37 +0000 +++ storage/ndb/include/ndbapi/Ndb.hpp 2009-12-07 11:49:25 +0000 @@ -1531,14 +1531,18 @@ public: */ const NdbError & getNdbError(int errorCode); + /* Maximum length of Error Detail string returned by getNdbErrorDetail() */ + static const Uint32 MAX_ERROR_DETAIL_BYTES = 512; + /** * Get a string containing any extra error details in the supplied - * buffer + * buffer. * Where there is extra detail available a ptr to the start of * the supplied buffer will be returned. * If the extra detail string is longer than the passed buffer * then it will be truncated to fit. * Where there is no extra detail, NULL will be returned. + * The string will be at most MAX_ERROR_DETAIL_BYTES long. */ const char* getNdbErrorDetail(const NdbError& err, char* buff, === modified file 'storage/ndb/src/ndbapi/Ndb.cpp' --- storage/ndb/src/ndbapi/Ndb.cpp 2009-12-03 18:15:24 +0000 +++ storage/ndb/src/ndbapi/Ndb.cpp 2009-12-07 11:41:20 +0000 @@ -2105,6 +2105,9 @@ Ndb::getNdbErrorDetail(const NdbError& e DBUG_PRINT("info", ("Found full index details : %s", result.c_str())); + assert(result.length() < MAX_ERROR_DETAIL_BYTES); + buffLen = MIN(buffLen, MAX_ERROR_DETAIL_BYTES); + memcpy(buff, result.c_str(), MIN(buffLen, (result.length() + 1)));