summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-07-09 08:27:19 +0200
committerGitHub <noreply@github.com>2019-07-09 08:27:19 +0200
commitbf82daf2fd2568135bcee9bd7dfba7649fef2884 (patch)
tree4bcdc2df098105bf2df1a84fcee0fd521c8f3d27
parent29ca79bd68bbec3dfbaec659f82eee0b03363ba8 (diff)
parent2f91e250f601e61e58fcb63b9bd72d29d7fc866b (diff)
Merge pull request #30432 from Faless/fix/string_http_unescape
Add NULL-terminator the string passed to strtol.
-rw-r--r--core/ustring.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 706e8a3cc1..75e3b6f22e 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3338,7 +3338,7 @@ String String::http_unescape() const {
if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) {
CharType ord2 = ord_at(i + 2);
if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) {
- char bytes[2] = { (char)ord1, (char)ord2 };
+ char bytes[3] = { (char)ord1, (char)ord2, 0 };
res += (char)strtol(bytes, NULL, 16);
i += 2;
}