From cf2d626bcab72e85a816f87b30e05029e671c76e 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 ceb7ff0c34..63efa8db7d 100644 --- a/api/src/Mail/Html.php +++ b/api/src/Mail/Html.php @@ -555,7 +555,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 = '