]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Limit the concurrency to MAX_CONCURRENCY.
authorMadhusudan Mathihalli <madhum@apache.org>
Sat, 27 Mar 2004 00:08:41 +0000 (00:08 +0000)
committerMadhusudan Mathihalli <madhum@apache.org>
Sat, 27 Mar 2004 00:08:41 +0000 (00:08 +0000)
Otherwise, ab may dump core (calloc fails) when a arbitrarily huge value
is used.

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

STATUS
support/ab.c

diff --git a/STATUS b/STATUS
index 482f237bc3db9c43781c2b7a248375cd049d271d..0971489202ec5919698d91b28c49583057f4ed6d 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/03/25 02:40:17 $]
+Last modified at [$Date: 2004/03/27 00:08:40 $]
 
 Release:
 
@@ -88,11 +88,6 @@ PATCHES TO BACKPORT FROM 2.1
            modules/dav/fs/lock.c: r1.31
        +1: trawick
 
-    *) Limit the concurrency in 'ab' to MAX_CONCURRENCY to prevent a 
-       segmentation fault.
-           support/ab.c: r1.140, r1.141
-       +1: madhum, trawick, jjclar
-
     *) Fix the comment delimiter so that it correctly parses the username
         comment.  Also add a terminate function to allow NetWare to pause
        the output before the screen is destroyed.
index 123f21566adf9dfc0a502bb2e708c179a7645485..4a9e0e9ac80c763e1a36d2619e1917e10e464fd7 100644 (file)
@@ -233,6 +233,7 @@ struct data {
 
 #define ap_min(a,b) ((a)<(b))?(a):(b)
 #define ap_max(a,b) ((a)>(b))?(a):(b)
+#define MAX_CONCURRENCY 20000
 
 /* --------------------- GLOBALS ---------------------------- */
 
@@ -1766,14 +1767,14 @@ static void test(void)
 static void copyright(void)
 {
     if (!use_html) {
-       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.9 $> apache-2.0");
+       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.10 $> 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.121.2.9 $");
+       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.10 $");
        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");
@@ -2139,6 +2140,11 @@ int main(int argc, const char * const argv[])
        usage(argv[0]);
     }
 
+    if ((concurrency < 0) || (concurrency > MAX_CONCURRENCY)) {
+       fprintf(stderr, "%s: Invalid Concurrency [Range 0..%d]\n",
+                argv[0], MAX_CONCURRENCY);
+        usage(argv[0]);
+    }
 
     if ((heartbeatres) && (requests > 150)) {
        heartbeatres = requests / 10;   /* Print line every 10% of requests */