From: Madhusudan Mathihalli Date: Sat, 27 Mar 2004 00:08:41 +0000 (+0000) Subject: Limit the concurrency to MAX_CONCURRENCY. X-Git-Tag: 2.0.50~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0b66753f036f7ef1a22e78db11ea2a9246191db;p=thirdparty%2Fapache%2Fhttpd.git 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/branches/APACHE_2_0_BRANCH@103166 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 482f237bc3d..0971489202e 100644 --- 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. diff --git a/support/ab.c b/support/ab.c index 123f21566ad..4a9e0e9ac80 100644 --- a/support/ab.c +++ b/support/ab.c @@ -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("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.9 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.10 $"); 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

\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 */