]> sjero.net Git - wget/commitdiff
Check `resp_status' function return code.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 4 May 2010 15:34:40 +0000 (17:34 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 4 May 2010 15:34:40 +0000 (17:34 +0200)
src/http.c

index 2330dde11e2d94f9ca2ea25256cad592e81c1a0d..52ed83653c55b84d0b50c38570c955e31784c863 100644 (file)
@@ -1888,6 +1888,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
 
           resp = resp_new (head);
           statcode = resp_status (resp, &message);
+          if (statcode < 0)
+            {
+              logprintf (LOG_NOTQUIET, _("Invalid server response.\n"));
+              CLOSE_INVALIDATE (sock);
+              xfree (head);
+              return HERR;
+            }
           hs->message = xstrdup (message);
           resp_free (resp);
           xfree (head);
@@ -1976,6 +1983,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
   /* Check for status line.  */
   message = NULL;
   statcode = resp_status (resp, &message);
+  if (statcode < 0)
+    {
+      logprintf (LOG_NOTQUIET, _("Invalid server response.\n"));
+      CLOSE_INVALIDATE (sock);
+      request_free (req);
+      return HERR;
+    }
   hs->message = xstrdup (message);
   if (!opt.server_response)
     logprintf (LOG_VERBOSE, "%2d %s\n", statcode,