madhum 2004/03/17 10:22:35
Modified: support ab.c
Log:
Limit the concurrency to MAX_CONCURRENCY.
Otherwise, ab may dump core (calloc fails) when a arbitrarily huge value
is used.
Revision Changes Path
1.140 +8 -2 httpd-2.0/support/ab.c
Index: ab.c
===================================================================
RCS file: /home/cvs/httpd-2.0/support/ab.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- ab.c 17 Mar 2004 00:06:44 -0000 1.139
+++ ab.c 17 Mar 2004 18:22:35 -0000 1.140
@@ -245,6 +245,7 @@
#define ap_min(a,b) ((a)<(b))?(a):(b)
#define ap_max(a,b) ((a)>(b))?(a):(b)
+#define MAX_CONCURRENCY 20000
/* --------------------- GLOBALS ---------------------------- */
@@ -2158,6 +2159,11 @@
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 */
|