Prevented a potential endless loop in StringUtil::replace()

This commit is contained in:
Leon Styhre 2022-04-30 18:31:53 +02:00
parent b638a99704
commit de48b69760

View file

@ -606,6 +606,10 @@ namespace Utils
replaced.append(result.substr(lastPos)); replaced.append(result.substr(lastPos));
result = replaced; result = replaced;
// Prevent endless loops.
if (to.find(from) != std::string::npos)
break;
} }
return result; return result;
} }