[njs] QueryString: fixed underflow in parse().

Dmitry Volyntsev xeioex at nginx.com
Tue Jan 9 00:57:17 UTC 2024


details:   https://hg.nginx.org/njs/rev/c43745da92cd
branches:  
changeset: 2254:c43745da92cd
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Jan 08 16:40:42 2024 -0800
description:
QueryString: fixed underflow in parse().

Previously, njs_query_string_append() might be provided with invalid
val_size value when value in a key-value pair was absent.

Found by UndefinedBehaviorSanitizer.

diffstat:

 external/njs_query_string_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 9fadb2e9c6ea -r c43745da92cd external/njs_query_string_module.c
--- a/external/njs_query_string_module.c	Mon Jan 08 16:40:42 2024 -0800
+++ b/external/njs_query_string_module.c	Mon Jan 08 16:40:42 2024 -0800
@@ -506,7 +506,7 @@ njs_query_string_parser(njs_vm_t *vm, u_
 
         size = val - key;
 
-        if (val != end) {
+        if (val != part) {
             val += eq->length;
         }
 


More information about the nginx-devel mailing list