From dfa18ab9d1e922418188ee4ad9dfcb976af4db30 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 12 Aug 2023 09:53:53 +0200 Subject: [PATCH] Fix handling of mail parts that are encoded with x-uuencode (#9096) --- CHANGELOG.md | 1 + program/lib/Roundcube/rcube_imap_generic.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8329f4e130..c83d4ed7cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Fix regression where LDAP addressbook 'filter' option was ignored (#9061) - Fix wrong order of a multi-folder search result when sorting by size (#9065) - Fix so install/update scripts do not require PEAR (#9037) +- Fix handling of mail parts that are encoded with x-uuencode (#9096) ## Release 1.6.2 diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index 6d021e2f1ed..bde6a2550ba 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -3004,10 +3004,12 @@ public function handlePartBody($mailbox, $id, $is_uid = false, $part = '', $enco } // UUENCODE else if ($mode == 3) { - $line = rtrim($line, "\t\r\n\0\x0B"); - if ($line == 'end' || preg_match('/^begin\s+[0-7]+\s+.+$/', $line)) { - continue; - } + $line = preg_replace( + ['/\r?\n/', '/\nend$/', '/^begin\s+[0-7]{3}\s+[^\n]+\n/'], + ["\n", '', ''], + $line + ); + $line = convert_uudecode($line); } // default