From: Dmitry Volyntsev Date: Thu, 11 Jan 2024 23:13:43 +0000 (-0800) Subject: QueryString: avoiding arithmetic ops with NULL in parse(). X-Git-Tag: 0.8.3~15 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=4356c55285c0e88483b8cb237ce30f1096c033ea;p=njs.git QueryString: avoiding arithmetic ops with NULL in parse(). Found by UndefinedBehaviorSanitizer. --- 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; }