From de81e92f0b9b45c161912c920dd395c9cb1f1177 Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Sun, 20 Jul 2008 08:28:32 -0400 Subject: [PATCH] Strip characters that shouldn't be in xml. Fixes http://laconi.ca/PITS/00253 for future messages, or all after a regeneration of rendered messages darcs-hash:20080720122832-533db-7fda43b257160b90788f0d860d50df995d463ee8.gz --- lib/util.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/util.php b/lib/util.php index 9ebb487a13..1ec68863e7 100644 --- a/lib/util.php +++ b/lib/util.php @@ -647,6 +647,8 @@ define('URL_REGEX', '^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet function common_render_content($text, $notice) { $r = htmlspecialchars($text); + + $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r); $id = $notice->profile_id; $r = preg_replace('@https?://[^)\]>\s]+@', '\0', $r); $r = preg_replace('/(^|\s+)@([a-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);