From: Stefan Fritsch Date: Fri, 15 Apr 2011 19:04:29 +0000 (+0000) Subject: Prevent segfault if DYNAMIC_MODULE_LIMIT is reached X-Git-Tag: 2.3.12~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e77a332640d426edbfa815e49a9e0bdfda87220c;p=thirdparty%2Fapache%2Fhttpd.git Prevent segfault if DYNAMIC_MODULE_LIMIT is reached PR: 51072 Submitted by: Torsten Förtsch git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1092787 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 6e9b68ea96a..a32c696262b 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.12 + *) core: Prevent segfault if DYNAMIC_MODULE_LIMIT is reached. PR 51072. + [Torsten Förtsch ] + *) WinNT MPM: Improve robustness under heavy load. [Jeff Trawick] *) MinGW build improvements. PR 49535. [John Vandenberg diff --git a/server/config.c b/server/config.c index 4e2b3c0d816..85dd7093fa2 100644 --- a/server/config.c +++ b/server/config.c @@ -541,22 +541,17 @@ AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p, m->name, m->version, MODULE_MAGIC_NUMBER_MAJOR); } - if (m->next == NULL) { - m->next = ap_top_module; - ap_top_module = m; - } - if (m->module_index == -1) { - m->module_index = total_modules++; - dynamic_modules++; - - if (dynamic_modules > DYNAMIC_MODULE_LIMIT) { + if (dynamic_modules >= DYNAMIC_MODULE_LIMIT) { return apr_psprintf(p, "Module \"%s\" could not be loaded, " "because the dynamic module limit was " "reached. Please increase " "DYNAMIC_MODULE_LIMIT and recompile.", m->name); } + m->module_index = total_modules++; + dynamic_modules++; + } else if (!sym_name) { while (sym->modp != NULL) { @@ -568,6 +563,11 @@ AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p, } } + if (m->next == NULL) { + m->next = ap_top_module; + ap_top_module = m; + } + if (sym_name) { int len = strlen(sym_name); int slen = strlen("_module");