From 192a90a5be73aac8585fda4774cae6be168631a0 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 30 Dec 2010 19:13:42 +0100 Subject: [PATCH] conv: prevent StripHtmlTags from falling into infinite loop malformed tags could cause this, e.g. ../span>
.., position of < would be the same as >, nothing would be actually removed and the operation would be performed ad infinitum. --- src/conv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conv.cpp b/src/conv.cpp index de977a5c..066a33e7 100644 --- a/src/conv.cpp +++ b/src/conv.cpp @@ -279,7 +279,7 @@ void StripHtmlTags(std::string &s) bool erase = 0; 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, ""); } Replace(s, "'", "'");