You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/04/15 21:04:30 UTC

svn commit: r1092787 - in /httpd/httpd/trunk: CHANGES server/config.c

Author: sf
Date: Fri Apr 15 19:04:29 2011
New Revision: 1092787

URL: http://svn.apache.org/viewvc?rev=1092787&view=rev
Log:
Prevent segfault if DYNAMIC_MODULE_LIMIT is reached

PR: 51072
Submitted by: Torsten Förtsch <torsten foertsch gmx net>

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1092787&r1=1092786&r2=1092787&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Apr 15 19:04:29 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.12
 
+  *) core: Prevent segfault if DYNAMIC_MODULE_LIMIT is reached. PR 51072.
+     [Torsten Förtsch <torsten foertsch gmx net>]
+
   *) WinNT MPM: Improve robustness under heavy load.  [Jeff Trawick]
 
   *) MinGW build improvements.  PR 49535.  [John Vandenberg 

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1092787&r1=1092786&r2=1092787&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Fri Apr 15 19:04:29 2011
@@ -541,22 +541,17 @@ AP_DECLARE(const char *) ap_add_module(m
                             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(m
         }
     }
 
+    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");