From 8b61d6a2d175ce1e17c8e483151fe35cb5fdf83d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 3 Jul 2017 12:33:30 +0200 Subject: [PATCH] Fix parsing dot-staffed lines in multiline text (#5838) --- CHANGELOG | 1 + plugins/managesieve/Changelog | 2 ++ plugins/managesieve/lib/Roundcube/rcube_sieve_script.php | 6 ++++-- plugins/managesieve/tests/src/parser_vacation | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7aa96d046..fc2bdd06c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,7 @@ CHANGELOG Roundcube Webmail - Fix various issues when downloading files with names containing non-ascii chars, use RFC 2231 (#5772) - Add Preferences > Mailbox View > Main Options > Layout (#5829) - Password: Fix compatibility with PHP 7+ in cpanel_webmail driver (#5820) +- Managesieve: Fix parsing dot-staffed lines in multiline text (#5838) - Fix decoding non-ascii attachment names from TNEF attachments (#5646, #5799) - Fix uninitialized string offset in rcube_utils::bin2ascii() and make sure rcube_utils::random_bytes() result has always requested length (#5788) - Fix bug where HTML messages with @media styles could moddify style of page body (#5811) diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index daa817725..bac149f2d 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,3 +1,5 @@ +- Fix parsing dot-staffed lines in multiline text (#5838) + * version 8.9 [2017-05-22] ----------------------------------------------------------- - Fix handling of scripts with nested rules (#5540) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php index 774be4623..73b888453 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php @@ -1277,11 +1277,13 @@ class rcube_sieve_script $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 diff --git a/plugins/managesieve/tests/src/parser_vacation b/plugins/managesieve/tests/src/parser_vacation index 93026db45..8603d37c4 100644 --- a/plugins/managesieve/tests/src/parser_vacation +++ b/plugins/managesieve/tests/src/parser_vacation @@ -5,6 +5,8 @@ if header :contains "Subject" "vacation" vacation :days 1 text: # test test test /* test */ +.. +..test test . ;