Skip to content

Commit

Permalink
Fix mangled non-ASCII characters in links in HTML messages (#6028)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Nov 8, 2017
1 parent 968e20c commit a0374f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CHANGELOG Roundcube Webmail
- Fix decoding of mailto: links with + character in HTML messages (#6020)
- Fix false reporting of failed upgrade in installto.sh (#6019)
- Fix file disclosure vulnerability caused by insuficient input validation in relation to attachment plugins (#6026)
- Fix mangled non-ASCII characters in links in HTML messages (#6028)

RELEASE 1.3.2
-------------
Expand Down
5 changes: 4 additions & 1 deletion program/lib/Roundcube/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ public static function attrib_string($attrib = array(), $allowed = null)
public static function parse_attrib_string($str)
{
$attrib = array();
$html = '<html><body><div ' . rtrim($str, '/ ') . ' /></body></html>';
$html = '<html>'
. '<head><meta http-equiv="Content-Type" content="text/html; charset=' . RCUBE_CHARSET . '" /></head>'
. '<body><div ' . rtrim($str, '/ ') . ' /></body>'
. '</html>';

$document = new DOMDocument('1.0', RCUBE_CHARSET);
@$document->loadHTML($html);
Expand Down
4 changes: 4 additions & 0 deletions tests/Framework/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ function data_parse_attrib_string()
'expression="test == true ? \' test\' : \'\'" ',
array('expression' => 'test == true ? \' test\' : \'\''),
),
array(
'href="http://domain.tld/страница"',
array('href' => 'http://domain.tld/страница'),
),
);
}

Expand Down

0 comments on commit a0374f3

Please sign in to comment.