From e00267f6f5faebd300e6770fdd1d61a98bc7dcb8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 3 Dec 2019 14:34:32 +0100 Subject: [PATCH] Fix replying to some mails with broken pre tags would cause infinite loop --- api/src/Mail/Html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/Mail/Html.php b/api/src/Mail/Html.php index 07e8de2fd0..51c91000db 100644 --- a/api/src/Mail/Html.php +++ b/api/src/Mail/Html.php @@ -493,7 +493,9 @@ class Html $html2ret[] = substr($html,0,$pos); while ($pos!==false) { - $endofpre = stripos($html,'',$pos); + // avoid infinit loop in case the endof pre can't be found, just give the + // end position to return the rest of content as return html + $endofpre = (stripos($html,'',$pos) === false ? strlen($html) : stripos($html,'',$pos)); $length = $endofpre-$pos+6; $html2ret[] = substr($html,$pos,$length); $searchFor = '