From 124ca7ff0059f65601c82f73108379f24c6c5ceb Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 21 Jul 2008 00:32:43 +0000 Subject: [PATCH] Prevent adjacent hyphens in a HTML/XML comment. Fixes #6642 for trunk. Props schiller. git-svn-id: https://develop.svn.wordpress.org/trunk@8382 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/kses.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 79f5366fe5..8dc776a945 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -431,6 +431,10 @@ function wp_kses_split2($string, $allowed_html, $allowed_protocols) { $string = $newstring; if ( $string == '' ) return ''; + // prevent multiple dashes in comments + $string = preg_replace('/--+/', '-', $string); + // prevent three dashes closing a comment + $string = preg_replace('/-$/', '', $string); return ""; } # Allow HTML comments @@ -1052,4 +1056,4 @@ function kses_init() { add_action('init', 'kses_init'); add_action('set_current_user', 'kses_init'); -?> \ No newline at end of file +?>