conv: prevent StripHtmlTags from falling into infinite loop
malformed tags could cause this, e.g. ../span><br>.., position of < would be the same as >, nothing would be actually removed and the operation would be performed ad infinitum.
This commit is contained in:
@@ -279,7 +279,7 @@ void StripHtmlTags(std::string &s)
|
|||||||
bool erase = 0;
|
bool erase = 0;
|
||||||
for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<"))
|
for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<"))
|
||||||
{
|
{
|
||||||
size_t j = s.find(">")+1;
|
size_t j = s.find(">", i)+1;
|
||||||
s.replace(i, j-i, "");
|
s.replace(i, j-i, "");
|
||||||
}
|
}
|
||||||
Replace(s, "'", "'");
|
Replace(s, "'", "'");
|
||||||
|
|||||||
Reference in New Issue
Block a user