Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79eec91

Browse files
committed
Fixed issue where an index in qs_parse is incorrectly incremented beyond the maximum possible value
1 parent 75c522f commit 79eec91

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/crow/query_string.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ inline int qs_parse(char* qs, char* qs_kv[], int qs_kv_size, bool parse_url = tr
119119
{
120120
qs_kv[i] = substr_ptr;
121121
j = strcspn(substr_ptr, "&");
122-
if ( substr_ptr[j] == '\0' ) { break; }
122+
if ( substr_ptr[j] == '\0' ) { i++; break; } // x &'s -> means x iterations of this loop -> means *x+1* k/v pairs
123123
substr_ptr += j + 1;
124124
i++;
125125
}
126-
i++; // x &'s -> means x iterations of this loop -> means *x+1* k/v pairs
127126

128127
// we only decode the values in place, the keys could have '='s in them
129128
// which will hose our ability to distinguish keys from values later

0 commit comments

Comments
 (0)