We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97c88bd commit 8791f72Copy full SHA for 8791f72
1 file changed
net/http/url.cpp
@@ -108,7 +108,7 @@ std::string url_escape(std::string_view url, bool escape_slash) {
108
std::string ret;
109
ret.reserve(url.size() * 2);
110
111
- for (auto c : url) {
+ for (unsigned char c : url) {
112
if (isunreserved(c)) {
113
ret.push_back(c);
114
} else if (!escape_slash && c == '/') {
@@ -126,7 +126,7 @@ std::string url_unescape(std::string_view url) {
126
127
ret.reserve(url.size());
128
for (unsigned int i = 0; i < url.size(); i++) {
129
- if (url[i] == '%') {
+ if (url[i] == '%' && i + 2 < url.size()) {
130
auto c = estring_view(url.substr(i + 1, 2)).hex_to_uint64();
131
ret += static_cast<char>(c);
132
i += 2;
0 commit comments