diff options
author | Robert Pösel <robyer@seznam.cz> | 2017-03-12 22:08:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-12 22:08:07 +0100 |
commit | 52c25fc77b6a06a6433ab36da9d94360f684cfe3 (patch) | |
tree | be1732e2423621c90f38b55eb16038fc6346cc95 /protocols/SkypeWeb/src | |
parent | 355d635f6caa8d3e2d77feafb3f7c8a964208a7e (diff) |
SkypeWeb: Fix replacing numeric HTML entities (fixes #685)
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
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 +} |