]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
cause a lookup failure if the map key contains a newline
authorAndré Malo <nd@apache.org>
Mon, 12 Jan 2004 02:05:19 +0000 (02:05 +0000)
committerAndré Malo <nd@apache.org>
Mon, 12 Jan 2004 02:05:19 +0000 (02:05 +0000)
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

src/CHANGES
src/modules/standard/mod_rewrite.c

index 89ba3f49654f916200eda5f6a22a814aca982f0d..01c5a594fcfc35912b40214be68cac34700fd56a 100644 (file)
@@ -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 <cedric.gavage unixtech.be>, André Malo]
+
   *) Forensic logging module added (mod_log_forensic).
      [Ben Laurie]
 
index cd0fe0b6c6d673088a7948246041b2229d259c29..98996a6eab89c2b9baf4e96e5815c388f94c08bf 100644 (file)
@@ -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);