From: André Malo Date: Sat, 28 Aug 2004 16:20:08 +0000 (+0000) Subject: Fix crash, when out of memory. X-Git-Tag: STRIKER_2_0_51_RC1^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4b594ff567585b06d713668abaaa37b7751c66b;p=thirdparty%2Fapache%2Fhttpd.git Fix crash, when out of memory. Submitted by: Reasoning report ID 29 Reviewed by: Erik Abele, Ian Holsman git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104887 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index dac975755dc..1cbac78cd3d 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/08/28 16:11:42 $] +Last modified at [$Date: 2004/08/28 16:20:08 $] Release: @@ -262,25 +262,6 @@ PATCHES TO BACKPORT FROM 2.1 shows breakage on Solaris which can't -lcrypto -lssl without the extra pkgconfig/openssl.pc Libs: * foo } - * ab: catch out of memory (reasoning report ID 29) - support/ab.c: r1.125 - +1: nd, erikabele, ianh - 0: trawick, who is not about to stand in anybody's way on this, - but has two comments nonetheless: - a) with no abort function specified for the pools, this is just - one of many possible failures - b) my guess is that a heap shortage encountered by ab is - much more likely to be caused by an ab bug instead of by a - user setup error (ulimit) or system resource shortage... - is an error message better than a coredump in that case? - - nd: hmm. This one is a pure (and obvious) malloc. Once we may - decide to use a pool-abort_fn; then the situation turns - around... :) - Yes, I think, a useful error message is better than - a coredump in this case. - jerenkrantz: Oh, bah. Let 'em segfault. Use flood! - * mod_ssl: fix a link failure when the openssl-engine libraries are present but the engine headers are missing. modules/ssl/mod_ssl.c: r1.87 diff --git a/support/ab.c b/support/ab.c index 41fe12f289b..77020dd15c2 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1599,7 +1599,11 @@ static void test(void) * Combine headers and (optional) post file into one contineous buffer */ if (posting == 1) { - char *buff = (char *) malloc(postlen + reqlen + 1); + char *buff = malloc(postlen + reqlen + 1); + if (!buff) { + fprintf(stderr, "error creating request buffer: out of memory\n"); + return; + } strcpy(buff, request); strcpy(buff + reqlen, postdata); request = buff; @@ -1768,14 +1772,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.11 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.12 $> 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.11 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.12 $"); 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");