From: Eric Covener Date: Mon, 8 Aug 2011 02:29:39 +0000 (+0000) Subject: Prevent a crash if a non-existent internal RewriteMap is specified X-Git-Tag: 2.3.15~399 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e74e7f63226d98fe854488aa8a0b923467684f7f;p=apache Prevent a crash if a non-existent internal RewriteMap is specified in a server context with RewiteEngine off, then later referenced. Submitted By: Ben Noordhuis Reviewed By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154808 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3d8c558f55..7c527fa24b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.3.15 + *) mod_rewrite: Check validity of each internal (int:) RewriteMap even if the + RewriteEngine is disabled in server context, avoiding a crash while + referencing the invalid int: map at runtime. PR 50994. + [Ben Noordhuis ] + *) mod_ssl, configure: require OpenSSL 0.9.7 or later. [Kaspar Brand] *) mod_ssl: remove ssl_toolkit_compat layer. [Kaspar Brand] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 87855dd7ae..0f6b61f250 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3043,7 +3043,7 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1, newmap->cachename = NULL; newmap->func = (char *(*)(request_rec *,char *)) apr_hash_get(mapfunc_hash, a2+4, strlen(a2+4)); - if ((sconf->state == ENGINE_ENABLED) && (newmap->func == NULL)) { + if (newmap->func == NULL) { return apr_pstrcat(cmd->pool, "RewriteMap: internal map not found:", a2+4, NULL); } @@ -3064,7 +3064,7 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1, newmap->fpin = NULL; newmap->fpout = NULL; - if (newmap->checkfile && (sconf->state == ENGINE_ENABLED) + if (newmap->checkfile && (apr_stat(&st, newmap->checkfile, APR_FINFO_MIN, cmd->pool) != APR_SUCCESS)) { return apr_pstrcat(cmd->pool,