diff options
author | Madhusudan Mathihalli <madhum@apache.org> | 2004-03-17 19:22:35 +0100 |
---|---|---|
committer | Madhusudan Mathihalli <madhum@apache.org> | 2004-03-17 19:22:35 +0100 |
commit | 87d5e2ed2b1d9d86366f0ff655fe215331200708 (patch) | |
tree | b523feae143908e7cd855b11023d95bd207bf7ad /support | |
parent | Remove the OMIT_DELONCLOSE #ifdef since this should happen automatically with... (diff) | |
download | apache2-87d5e2ed2b1d9d86366f0ff655fe215331200708.tar.xz apache2-87d5e2ed2b1d9d86366f0ff655fe215331200708.zip |
Limit the concurrency to MAX_CONCURRENCY.
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/trunk@103011 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support')
-rw-r--r-- | support/ab.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/support/ab.c b/support/ab.c index d30e1aca74..296ac6eced 100644 --- a/support/ab.c +++ b/support/ab.c @@ -245,6 +245,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 ---------------------------- */ @@ -1785,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.139 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.140 $> 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><%s></i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.139 $"); + printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.140 $"); 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"); @@ -2158,6 +2159,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 */ |