Commit 83ef8c58 authored by serg@serg.mylan's avatar serg@serg.mylan

make the code to look safe, not only be safe

parent fa38a0d1
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
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;
} }
#endif #endif
...@@ -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