use strict hex parsing in decode_query_component (#2472)

This commit is contained in:
metsw24-max authored and GitHub committed 2026-06-12 13:54:04 -04:00
1 parent 7532932276
commit 28d95937b5
2 files changed
+16 -5

No files matched your search

+3 -5
View File
@@ -9734,11 +9734,9 @@ inline std::string decode_query_component(const std::string &component,
for (size_t i = 0; i < component.size(); i++) {
if (component[i] == '%' && i + 2 < component.size()) {
std::string hex = component.substr(i + 1, 2);
char *end;
unsigned long value = std::strtoul(hex.c_str(), &end, 16);
if (end == hex.c_str() + 2) {
result += static_cast<char>(value);
auto val = 0;
if (detail::from_hex_to_i(component, i + 1, 2, val)) {
result += static_cast<char>(val);
i += 2;
} else {
result += component[i];