Commit 77b8a94d authored by unknown's avatar unknown

make the code to look safe, not only be safe

parent 3c45559d
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
char * char *
strdup(const char *s){ strdup(const char *s){
void *p2; void *p2;
p2 = malloc(strlen(s)+1); if ((p2 = malloc(strlen(s)+1)))
strcpy(p2, s); strcpy(p2, s);
return p2; return p2;
} }
......
...@@ -2247,9 +2247,9 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, ...@@ -2247,9 +2247,9 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
DBUG_ENTER("print_buffer_to_nt_eventlog"); DBUG_ENTER("print_buffer_to_nt_eventlog");
buffptr= buff; buffptr= buff;
if (length > (uint)(buffLen-4)) if (length > (uint)(buffLen-5))
{ {
char *newBuff= new char[length + 4]; char *newBuff= new char[length + 5];
strcpy(newBuff, buff); strcpy(newBuff, buff);
buffptr= newBuff; buffptr= newBuff;
} }
......
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