From 2bed74f80c1faff1971aa25984eff7b1789d6f32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Tue, 29 Jul 2003 01:14:17 +0000 Subject: [PATCH] cause a lookup failure in external rewrite maps if the key contains a newline. PR: 14453 Submitted originally by: Cedric Gavage git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100833 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/mappers/mod_rewrite.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 50c95abcc3..8f0ef853b5 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_rewrite: In external rewrite maps lookup keys containing + a newline now cause a lookup failure. PR 14453. + [Cedric Gavage , André Malo] + *) Install config.nice into the build/ directory to make minor version upgrades easier. [Joshua Slive] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 437c0e55bb..71376ad016 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -1290,8 +1290,13 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin, * 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 == NULL || fpout == NULL) { + if (fpin == NULL || fpout == NULL || ap_strchr(key, '\n')) { return NULL; } -- 2.50.1