From 48fa26028f1e21a3c11842b76ebee9032336abf3 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sun, 6 Oct 2013 20:58:20 +0200 Subject: [PATCH] + fix small regression in the unescape_url() code --- src/common/kiwix/reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/kiwix/reader.cpp b/src/common/kiwix/reader.cpp index 8e52f8a5e..0f7998673 100644 --- a/src/common/kiwix/reader.cpp +++ b/src/common/kiwix/reader.cpp @@ -60,7 +60,7 @@ static char charFromHex(std::string a) { void unescapeUrl(string &url) { std::string::size_type pos = 0; - while ((pos = url.find('%', pos + 1)) != std::string::npos && + while ((pos = url.find('%', pos ? pos + 1 : pos)) != std::string::npos && pos + 3 <= url.length()) { url.replace(pos, 3, 1, charFromHex(url.substr(pos + 1, 2))); }