[njs] QuickJS: correctly handling value len for empty query params.

noreply at nginx.com noreply at nginx.com
Fri Jan 24 23:13:02 UTC 2025


details:   https://github.com/nginx/njs/commit/9f15b6986a1b5cd20b9c589142f5a0e586f8d798
branches:  master
commit:    9f15b6986a1b5cd20b9c589142f5a0e586f8d798
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed, 22 Jan 2025 17:44:11 -0800
description:
QuickJS: correctly handling value len for empty query params.


---
 nginx/ngx_http_js_module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c
index e900b716..9b6d8ea1 100644
--- a/nginx/ngx_http_js_module.c
+++ b/nginx/ngx_http_js_module.c
@@ -4848,7 +4848,7 @@ ngx_http_qjs_ext_args(JSContext *cx, JSValueConst this_val)
             return JS_EXCEPTION;
         }
 
-        val = qjs_string_create(cx, v + 1, p - v - 1);
+        val = qjs_string_create(cx, v + 1, (p == v) ? 0 : p - v - 1);
         if (JS_IsException(val)) {
             chain.free(cx, decoded.start);
             JS_FreeAtom(cx, key);


More information about the nginx-devel mailing list