1
0
mirror of synced 2025-04-26 14:28:51 +03:00

Merge pull request #76 from crtxcr/bounds_check_fix

Fixed bound checks for #74
This commit is contained in:
yhirose 2018-06-02 06:40:42 -04:00 committed by GitHub
commit 962c8985b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1001,9 +1001,9 @@ inline std::string decode_url(const std::string& s)
{
std::string result;
for (size_t i = 0; s[i]; i++) {
for (size_t i = 0; i < s.size(); i++) {
if (s[i] == '%' && i + 1 < s.size()) {
if (s[i + 1] && s[i + 1] == 'u') {
if (s[i + 1] == 'u') {
int val = 0;
if (from_hex_to_i(s, i + 2, 4, val)) {
// 4 digits Unicode codes