]> granicus.if.org Git - curl/commitdiff
SWS: use of uninitialized memory fix
authorDaniel Stenberg <daniel@haxx.se>
Wed, 11 Jul 2012 22:07:16 +0000 (00:07 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 11 Jul 2012 22:08:38 +0000 (00:08 +0200)
I made "connmon" not get initialized properly before use, and I use the
big hammer and make sure we always clear the entire struct to avoid any
problem like this in the future.

tests/server/sws.c

index aaacb354694184543b51ad9eec28a580a8424bd8..b4961a5edafa304ab4b4d620663c20cacf5e6d6a 100644 (file)
@@ -1440,6 +1440,7 @@ static void http_connect(curl_socket_t *infdp,
         if(datafd != CURL_SOCKET_BAD) {
           struct httprequest req2;
           int err;
+          memset(&req2, 0, sizeof(req2));
           logmsg("====> Client connect DATA");
 #ifdef TCP_NODELAY
           /* Disable the Nagle algorithm */
@@ -1699,6 +1700,8 @@ int main(int argc, char *argv[])
   bool use_fork = FALSE;
 #endif
 
+  memset(&req, 0, sizeof(req));
+
   while(argc>arg) {
     if(!strcmp("--version", argv[arg])) {
       printf("sws IPv4%s"