From: André Malo Date: Mon, 12 Jan 2004 02:05:19 +0000 (+0000) Subject: cause a lookup failure if the map key contains a newline X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2456d21164320e785756d844f8b7268e0a02fa16;p=thirdparty%2Fapache%2Fhttpd.git cause a lookup failure if the map key contains a newline PR: 14453 Reviewed by: Jeff Trawick, Justin Erenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@102279 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index 89ba3f49654..01c5a594fcf 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 1.3.30 + *) mod_rewrite: In external rewrite maps lookup keys containing + a newline now cause a lookup failure. PR 14453. + [Cedric Gavage , André Malo] + *) Forensic logging module added (mod_log_forensic). [Ben Laurie] diff --git a/src/modules/standard/mod_rewrite.c b/src/modules/standard/mod_rewrite.c index cd0fe0b6c6d..98996a6eab8 100644 --- a/src/modules/standard/mod_rewrite.c +++ b/src/modules/standard/mod_rewrite.c @@ -3100,11 +3100,16 @@ static char *lookup_map_program(request_rec *r, int fpin, int fpout, char *key) * context then the rewritemap-programs were not spawned. * In this case using such a map (usually in per-dir context) * is useless because it is not available. + * + * newlines in the key leave bytes in the pipe and cause + * bad things to happen (next map lookup will use the chars + * after the \n instead of the new key etc etc - in other words, + * the Rewritemap falls out of sync with the requests). */ - if (fpin == -1 || fpout == -1) { + if (fpin == -1 || fpout == -1 || strchr(key, '\n')) { return NULL; } - + /* take the lock */ rewritelock_alloc(r);