diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-11-28 09:12:03 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-11-28 09:12:03 +0100 |
commit | ffec857b697ce0a23134f04cf345dc3a8b45a7ae (patch) | |
tree | eb93710b360ef9971d2ce4c699e5aec278d7c83e /program/lib/Roundcube | |
parent | 993eb88d5aaeccd2d60758dd01f27265230e18b7 (diff) |
Fix handling of invalid closing tags in HTML messages (#1489446)
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r-- | program/lib/Roundcube/rcube_washtml.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php index e7467545f..9cf3c6222 100644 --- a/program/lib/Roundcube/rcube_washtml.php +++ b/program/lib/Roundcube/rcube_washtml.php @@ -455,7 +455,7 @@ class rcube_washtml } // fix (unknown/malformed) HTML tags before "wash" - $html = preg_replace_callback('/(<(?!\!)[\/]*)([^\s>]+)/', array($this, 'html_tag_callback'), $html); + $html = preg_replace_callback('/(<(?!\!)[\/]*)([^\s>]+)([^>]*)/', array($this, 'html_tag_callback'), $html); // Remove invalid HTML comments (#1487759) // Don't remove valid conditional comments @@ -479,7 +479,12 @@ class rcube_washtml '/[^a-z0-9_\[\]\!-]/i', // forbidden characters ), '', $tagname); - return $matches[1] . $tagname; + // fix invalid closing tags - remove any attributes (#1489446) + if ($matches[1] == '</') { + $matches[3] = ''; + } + + return $matches[1] . $tagname . $matches[3]; } /** |