BUG#21052 Modify the overflow error existed in last patch.

parent cdf20b96
...@@ -93,7 +93,7 @@ typedef ndberror_classification_enum ndberror_classification; ...@@ -93,7 +93,7 @@ typedef ndberror_classification_enum ndberror_classification;
const char *ndberror_status_message(ndberror_status); const char *ndberror_status_message(ndberror_status);
const char *ndberror_classification_message(ndberror_classification); const char *ndberror_classification_message(ndberror_classification);
void ndberror_update(ndberror_struct *); void ndberror_update(ndberror_struct *);
int ndb_error_string(int err_no, char *str, unsigned int size); int ndb_error_string(int err_no, char *str, int size);
#endif /* doxygen skip internal*/ #endif /* doxygen skip internal*/
......
...@@ -1337,7 +1337,7 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId) ...@@ -1337,7 +1337,7 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId)
if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity,textF)) if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity,textF))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
char m_text[256]; char m_text[512];
EventLogger::getText(m_text, sizeof(m_text), EventLogger::getText(m_text, sizeof(m_text),
textF, theData, nodeId); textF, theData, nodeId);
...@@ -1356,8 +1356,11 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId) ...@@ -1356,8 +1356,11 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId)
if(strcmp(ndb_logevent_body[i].token,"error") == 0) if(strcmp(ndb_logevent_body[i].token,"error") == 0)
{ {
int m_text_len= strlen(m_text); int m_text_len= strlen(m_text);
snprintf(m_text+m_text_len, 4 , " - "); if(sizeof(m_text)-m_text_len-3 > 0)
ndb_error_string(theData[3], m_text+(m_text_len+3), sizeof(m_text)-m_text_len-3); {
BaseString::snprintf(m_text+m_text_len, 4 , " - ");
ndb_error_string(val, m_text+(m_text_len+3), sizeof(m_text)-m_text_len-3);
}
} }
} }
......
...@@ -680,11 +680,14 @@ const char *ndberror_classification_message(ndberror_classification classificati ...@@ -680,11 +680,14 @@ const char *ndberror_classification_message(ndberror_classification classificati
return empty_string; return empty_string;
} }
int ndb_error_string(int err_no, char *str, unsigned int size) int ndb_error_string(int err_no, char *str, int size)
{ {
ndberror_struct error; ndberror_struct error;
unsigned int len; int len;
assert(size > 1);
if(size <= 1)
return 0;
error.code = err_no; error.code = err_no;
ndberror_update(&error); ndberror_update(&error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment