summaryrefslogtreecommitdiffstats
path: root/server/config.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2011-04-15 21:04:29 +0200
committerStefan Fritsch <sf@apache.org>2011-04-15 21:04:29 +0200
commite77a332640d426edbfa815e49a9e0bdfda87220c (patch)
tree256e98bf25b5cf4a5530b31f8e493ea58b95c1dc /server/config.c
parentmove -L/path/to/pcrelib -lpcre out beyond all the LDFLAGS (diff)
downloadapache2-e77a332640d426edbfa815e49a9e0bdfda87220c.tar.xz
apache2-e77a332640d426edbfa815e49a9e0bdfda87220c.zip
Prevent segfault if DYNAMIC_MODULE_LIMIT is reached
PR: 51072 Submitted by: Torsten Förtsch <torsten foertsch gmx net> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1092787 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/config.c')
-rw-r--r--server/config.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/config.c b/server/config.c
index 4e2b3c0d81..85dd7093fa 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");