From 62dae4cc32229e372bb81c0a20c19f2727345e71 Mon Sep 17 00:00:00 2001 From: The-EDev Date: Mon, 27 Jun 2022 22:38:24 +0300 Subject: [PATCH] Fixed issue where an index in qs_parse is incorrectly incremented beyond the maximum possible value (cherry picked from commit 79eec91f00b5fb7df890d4e84b2f048b0841e044) --- include/crow/query_string.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/crow/query_string.h b/include/crow/query_string.h index 3f13e8a96..f8edbe89a 100644 --- a/include/crow/query_string.h +++ b/include/crow/query_string.h @@ -115,11 +115,10 @@ inline int qs_parse(char * qs, char * qs_kv[], int qs_kv_size) { qs_kv[i] = 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; 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 // which will hose our ability to distinguish keys from values later