changeset 2266:2b221f44efa6

QueryString: avoiding arithmetic ops with NULL in parse(). Found by UndefinedBehaviorSanitizer.
author Dmitry Volyntsev <xeioex@nginx.com>
date Thu, 11 Jan 2024 15:13:43 -0800
parents a5f279148c9f
children 4fba78789fe4
files external/njs_query_string_module.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/external/njs_query_string_module.c	Wed Jan 10 16:26:35 2024 -0800
+++ b/external/njs_query_string_module.c	Thu Jan 11 15:13:43 2024 -0800
@@ -491,7 +491,7 @@
 
     key = query;
 
-    do {
+    while (key < end) {
         if (count++ == max_keys) {
             break;
         }
@@ -519,8 +519,7 @@
     next:
 
         key = part + sep->length;
-
-    } while (key < end);
+    }
 
     return NJS_OK;
 }