[njs] QueryString: avoiding arithmetic ops with NULL in parse().
Dmitry Volyntsev
xeioex at nginx.com
Thu Jan 11 23:15:35 UTC 2024
details: https://hg.nginx.org/njs/rev/2b221f44efa6
branches:
changeset: 2266:2b221f44efa6
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Thu Jan 11 15:13:43 2024 -0800
description:
QueryString: avoiding arithmetic ops with NULL in parse().
Found by UndefinedBehaviorSanitizer.
diffstat:
external/njs_query_string_module.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diffs (22 lines):
diff -r a5f279148c9f -r 2b221f44efa6 external/njs_query_string_module.c
--- 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 @@ njs_query_string_parser(njs_vm_t *vm, u_
key = query;
- do {
+ while (key < end) {
if (count++ == max_keys) {
break;
}
@@ -519,8 +519,7 @@ njs_query_string_parser(njs_vm_t *vm, u_
next:
key = part + sep->length;
-
- } while (key < end);
+ }
return NJS_OK;
}
More information about the nginx-devel
mailing list