From 52c25fc77b6a06a6433ab36da9d94360f684cfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 12 Mar 2017 22:08:07 +0100 Subject: SkypeWeb: Fix replacing numeric HTML entities (fixes #685) --- protocols/SkypeWeb/src/skype_utils.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 70ce68f948..3f91e7242f 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -374,7 +374,7 @@ char *CSkypeProto::RemoveHtml(const char *text) { // Numeric replacement bool hex = false; - if (data.at(1) == 'x') + if (entity.at(1) == 'x') { hex = true; entity = entity.substr(2); @@ -385,9 +385,14 @@ char *CSkypeProto::RemoveHtml(const char *text) } if (!entity.empty()) { + found = true; + errno = 0; unsigned long value = strtoul(entity.c_str(), NULL, hex ? 16 : 10); - - if (value <= 127) + if (errno != 0) + { // error with conversion in strtoul, ignore the result + found = false; + } + else if (value <= 127) { // U+0000 .. U+007F new_string += (char)value; } @@ -409,7 +414,6 @@ char *CSkypeProto::RemoveHtml(const char *text) new_string += (char)((value >> 8) & 0xFF); new_string += (char)((value)& 0xFF); } - found = true; } } else @@ -619,4 +623,4 @@ INT_PTR CSkypeProto::GlobalParseSkypeUriService(WPARAM wParam, LPARAM lParam) return Accounts[i]->ParseSkypeUriService(wParam, lParam); return 1; -} \ No newline at end of file +} -- cgit v1.2.3