]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport ab NULL-pointer issue fix from apache-2.1
authorMartin Kraemer <martin@apache.org>
Sun, 6 Jul 2003 17:52:27 +0000 (17:52 +0000)
committerMartin Kraemer <martin@apache.org>
Sun, 6 Jul 2003 17:52:27 +0000 (17:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@100465 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/support/ab.c

index 8892e0c15575611803f017ec2bca5f75c678ba65..63b9db884ffbd7a375004121f10026f14bac7a29 100644 (file)
@@ -1,5 +1,8 @@
 Changes with Apache 1.3.28
 
+  *) Fix NULL-pointer issue in ab when parsing an incomplete or non-HTTP
+     response. PR 21085. [Glenn Nielsen <glenn@apache.org>, AndrĂ© Malo]
+
   *) Removed BIND_NOSTART from HP/UX shl_load() logic for loadable
      Apache modules, so that statics are initialized when the module
      is loaded (especially critical for c++ modules on HPUX.)
index 1b318a7497d95bab02a7d2472af1671458ba4a5b..3e2cbda468456e7913c3639316b608a0b91bc597 100644 (file)
@@ -1098,8 +1098,14 @@ static void read_connection(struct connection * c)
 
            /* check response code */
            part = strstr(c->cbuff, "HTTP");    /* really HTTP/1.x_ */
-           strncpy(respcode, (part + strlen("HTTP/1.x_")), 3);
-           respcode[3] = '\0';
+            if (part && strlen(part) > strlen("HTTP/1.x_")) {
+                strncpy(respcode, (part + strlen("HTTP/1.x_")), 3);
+                respcode[3] = '\0';
+            }
+            else {
+                strcpy(respcode, "500");
+            }
+
            if (respcode[0] != '2') {
                err_response++;
                if (verbosity >= 2)
@@ -1352,14 +1358,14 @@ static void test(void)
 static void copyright(void)
 {
     if (!use_html) {
-       printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.68 $> apache-1.3");
+       printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.69 $> apache-1.3");
        printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
        printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n");
        printf("\n");
     }
     else {
        printf("<p>\n");
-       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-1.3<br>\n", VERSION, "$Revision: 1.68 $");
+       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-1.3<br>\n", VERSION, "$Revision: 1.69 $");
        printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
        printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n");
        printf("</p>\n<p>\n");