From a74ebcc87a63628f8c4e0ea35a694b8f299c0633 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 30 Nov 2005 15:31:23 +0000 Subject: - More fixes --- includes/file.inc | 4 ++++ modules/filter.module | 28 +++++++++++++++++----------- modules/filter/filter.module | 28 +++++++++++++++++----------- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/includes/file.inc b/includes/file.inc index dca300079..a1232f1e9 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -456,6 +456,10 @@ function file_transfer($source, $headers) { ob_end_clean(); foreach ($headers as $header) { + // To prevent HTTP header injection, we delete new lines that are + // not followed by a space or a tab. + // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 + $header = preg_replace('/\r?\n(?!\t| )/', '', $header); header($header); } diff --git a/modules/filter.module b/modules/filter.module index 280f53a21..7b007c5ea 100644 --- a/modules/filter.module +++ b/modules/filter.module @@ -980,7 +980,8 @@ function _filter_html_settings($format) { */ function _filter_html($text, $format) { if (variable_get("filter_html_$format", FILTER_HTML_STRIP) == FILTER_HTML_STRIP) { - $text = filter_xss($text, $format); + $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format", '