From: Eric Covener Date: Sat, 3 Sep 2011 22:54:25 +0000 (+0000) Subject: backport r1154808 from trunk: X-Git-Tag: 2.2.21~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd0bebd55430ec35c571c5f1315d6f54fd855232;p=thirdparty%2Fapache%2Fhttpd.git backport r1154808 from trunk: 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, sf, trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1164941 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 550df4546f5..31ec1293c42 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.21 + *) 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 ] + *) core: Add MaxRanges directive to control the number of ranges permitted before returning the entire resource, with a default limit of 200. [Eric Covener] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 700107385f2..8887bea53a3 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2978,7 +2978,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); } @@ -2999,7 +2999,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,