From 2a837d525fec83185d251a5cbf8bb447a93fdcdf Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 8 Jul 2019 17:15:10 +0200 Subject: [PATCH] Add NULL-terminator the string passed to strtol. This is actually expected by the function although it was apparently working in GCC without the terminator, it breaks (at least some) clang versions. (cherry picked from commit 2f91e250f601e61e58fcb63b9bd72d29d7fc866b) --- core/ustring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index ff8fcaaaaf..6b276b7195 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3297,7 +3297,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; }