Fixed issue where an index in qs_parse is incorrectly incremented beyond the maximum possible value

This commit is contained in:
The-EDev 2022-06-27 22:38:24 +03:00
parent 75c522f4f5
commit 79eec91f00
No known key found for this signature in database
GPG Key ID: 51C45DC0C413DCD9

View File

@ -119,11 +119,10 @@ inline int qs_parse(char* qs, char* qs_kv[], int qs_kv_size, bool parse_url = tr
{ {
qs_kv[i] = substr_ptr; qs_kv[i] = substr_ptr;
j = strcspn(substr_ptr, "&"); j = strcspn(substr_ptr, "&");
if ( substr_ptr[j] == '\0' ) { break; } if ( substr_ptr[j] == '\0' ) { i++; break; } // x &'s -> means x iterations of this loop -> means *x+1* k/v pairs
substr_ptr += j + 1; substr_ptr += j + 1;
i++; i++;
} }
i++; // x &'s -> means x iterations of this loop -> means *x+1* k/v pairs
// we only decode the values in place, the keys could have '='s in them // we only decode the values in place, the keys could have '='s in them
// which will hose our ability to distinguish keys from values later // which will hose our ability to distinguish keys from values later