Null terminate string in buffer before feeding it to strtol()
authorYang Tse <yangsita@gmail.com>
Fri, 14 Jul 2006 06:31:41 +0000 (06:31 +0000)
committerYang Tse <yangsita@gmail.com>
Fri, 14 Jul 2006 06:31:41 +0000 (06:31 +0000)
tests/server/sockfilt.c

index 333e02f..4b9fec4 100644 (file)
@@ -290,6 +290,7 @@ static int juggle(curl_socket_t *sockfdp,
 
         if(5 != read(fileno(stdin), buffer, 5))
           return FALSE;
+        buffer[4] = '\0';
 
         len = (ssize_t)strtol((char *)buffer, NULL, 16);
         if(len != read(fileno(stdin), buffer, len))