Skip to content

Commit

Permalink
Fix parsing dot-staffed lines in multiline text (#5838)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Oct 12, 2017
1 parent 1fd9ad2 commit 24edb8d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail
- Fix rewind(): stream does not support seeking (#5950)
- Fix bug where HTML messages could have been rendered empty on some systems (#5957)
- Fix (again) bug where image data URIs in css style were treated as evil/remote in mail preview (#5580)
- Managesieve: Fix parsing dot-staffed lines in multiline text (#5838, #5959)

RELEASE 1.2.6
-------------
Expand Down
1 change: 1 addition & 0 deletions plugins/managesieve/Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fix parsing dot-staffed lines in multiline text (#5838)
- Fix handling of scripts with nested rules (#5540)
- Fix possible defect in handling \r\n in scripts (#5685)

Expand Down
6 changes: 4 additions & 2 deletions plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,11 +1231,13 @@ static function tokenize($str, $num = 0, &$position = 0)
$text .= substr($str, $position, $pos - $position);
$position = $pos + 2;

if ($str[$pos] == "\n"
|| ($str[$pos] == "\r" && $str[$pos + 1] == "\n")
if ($str[$position] == "\n"
|| ($str[$position] == "\r" && $str[$position + 1] == "\n")
) {
break;
}

$text .= "\n.";
}

// remove dot-stuffing
Expand Down
2 changes: 2 additions & 0 deletions plugins/managesieve/tests/src/parser_vacation
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if header :contains "Subject" "vacation"
vacation :days 1 text:
# test
test test /* test */
..
..test
test
.
;
Expand Down

0 comments on commit 24edb8d

Please sign in to comment.