From: Alexander Ebert Date: Thu, 17 Nov 2016 11:49:34 +0000 (+0100) Subject: Fixed infinite loop during mention parsing X-Git-Tag: 3.0.0_Beta_5~41 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=59caaa6f716f46ee78445c031550788a22040e2f;p=GitHub%2FWoltLab%2FWCF.git Fixed infinite loop during mention parsing --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 7894724c60..b466393a21 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -309,9 +309,10 @@ class HtmlInputNodeTextParser { } foreach ($users as $userID => $username) { + $offset = 0; do { $needle = '@' . $username; - $pos = mb_stripos($value, $needle); + $pos = mb_stripos($value, $needle, $offset); // username not found, maybe it is quoted if ($pos === false) { @@ -331,6 +332,8 @@ class HtmlInputNodeTextParser { // and we need to replace them one by one, also avoiding only replacing // the non-quoted username even though both variants are present $value = preg_replace('~' . preg_quote($needle, '~') . '~i', $marker, $value, 1); + + $offset = $pos + 1; } } while ($pos);