From 3240e911408b157863f0f276e443db03997df6f4 Mon Sep 17 00:00:00 2001 From: brectanus Date: Fri, 30 May 2008 20:01:44 +0000 Subject: [PATCH] Fixed XML multithreading crash. See #501. --- CHANGES | 5 ++++- apache2/modsecurity.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8285fb95..34db2233 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -09 May 2008 - 2.5.5-dev1 +30 May 2008 - 2.5.5-dev1 ------------------------ +* Fixed issue with multithreaded servers where concurrent XML processing + could crash the web server (at least under Windows). + * Fixed blocking in phase 3. * Force modules "mod_rpaf-2.0.c" and "mod_custom_header.c" to run before diff --git a/apache2/modsecurity.c b/apache2/modsecurity.c index f1092eb1..b79df23a 100644 --- a/apache2/modsecurity.c +++ b/apache2/modsecurity.c @@ -15,6 +15,7 @@ #include "modsecurity.h" #include "msc_parsers.h" #include "msc_util.h" +#include "msc_xml.h" modsec_build_type_rec DSOLOCAL modsec_build_type[] = { { "-dev", 1 }, /* Development build */ @@ -121,6 +122,9 @@ int modsecurity_init(msc_engine *msce, apr_pool_t *mp) { * Performs per-child (new process) initialisation. */ void modsecurity_child_init(msc_engine *msce) { + /* Need to call this once per process before any other XML calls. */ + xmlInitParser(); + if (msce->auditlog_lock != NULL) { apr_status_t rc = apr_global_mutex_child_init(&msce->auditlog_lock, NULL, msce->mp); if (rc != APR_SUCCESS) {