From 4356c55285c0e88483b8cb237ce30f1096c033ea Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Thu, 11 Jan 2024 15:13:43 -0800 Subject: [PATCH] QueryString: avoiding arithmetic ops with NULL in parse(). Found by UndefinedBehaviorSanitizer. --- external/njs_query_string_module.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/external/njs_query_string_module.c b/external/njs_query_string_module.c index c927d8e4..f97fb223 100644 --- a/external/njs_query_string_module.c +++ b/external/njs_query_string_module.c @@ -491,7 +491,7 @@ njs_query_string_parser(njs_vm_t *vm, u_char *query, u_char *end, key = query; - do { + while (key < end) { if (count++ == max_keys) { break; } @@ -519,8 +519,7 @@ njs_query_string_parser(njs_vm_t *vm, u_char *query, u_char *end, next: key = part + sep->length; - - } while (key < end); + } return NJS_OK; } -- 2.47.3