From df0cfdfc8969d38e509ad57a18659d209b3f0ddd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Oct 2023 14:33:27 +0300 Subject: NewStory: fix for the eternal loop in RemoveBbcodes() --- plugins/NewStory/src/utils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index e5fce8ffc6..7bef6e83a6 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -78,6 +78,7 @@ void RemoveBbcodes(CMStringW &wszText) } for (int idx = wszText.Find('[', 0); idx != -1; idx = wszText.Find('[', idx)) { + bool bFound = false; for (auto &it : bbcodes) { if (wcsncmp(wszText.c_str() + idx, it.pStart, it.cbStart)) continue; @@ -92,7 +93,12 @@ void RemoveBbcodes(CMStringW &wszText) } } + bFound = true; break; } + + // just an occasional square bracket? skip it + if (!bFound) + idx++; } } -- cgit v1.2.3