]> granicus.if.org Git - apache/commitdiff
Fix NULL-pointer issue in ab when parsing an incomplete or non-HTTP
authorAndré Malo <nd@apache.org>
Sun, 29 Jun 2003 17:41:56 +0000 (17:41 +0000)
committerAndré Malo <nd@apache.org>
Sun, 29 Jun 2003 17:41:56 +0000 (17:41 +0000)
response.

PR: 21085
Submitted by: Glenn Nielsen <glenn@apache.org>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100399 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/ab.c

diff --git a/CHANGES b/CHANGES
index 08df847a1199fdb573d2fc17638ac76b15f4fe56..8eeaf1b0d1f13a5ce043ca6f559508cde3b7f8ad 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Fix NULL-pointer issue in ab when parsing an incomplete or non-HTTP
+     response. PR 21085. [Glenn Nielsen <glenn@apache.org>, André Malo]
+
   *) Added FreeBSD directory layout. PR 21100.
      [Sander Holthaus <info@orangexl.com>, André Malo]
 
index 670ca7ad4ad38bc4fc7fc66af17c203f487437a4..2af5d16f341507db1685f4cce014ffc8222c6688 100644 (file)
@@ -1484,8 +1484,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)
@@ -1780,14 +1786,14 @@ static void test(void)
 static void copyright(void)
 {
     if (!use_html) {
-       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.123 $> apache-2.0");
+       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.124 $> apache-2.0");
        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-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.123 $");
+       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.124 $");
        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");