Commit 449828a9 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

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
parent 3d382a11
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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 
+9 −9
Changes for server/config.c: 9 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -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");