mirror of
https://github.com/apache/httpd.git
synced 2026-01-06 09:01:14 +03:00
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
This commit is contained in:
10
support/ab.c
10
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 */
|
||||
|
||||
Reference in New Issue
Block a user