From 9634a15b32610931a1d69317fcd5ae7f8715d02f Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Wed, 20 Mar 2019 15:56:22 +0300 Subject: [PATCH] HTTP: handling absence of value while iterating over r.args. --- nginx/ngx_http_js_module.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index 0705d5a8..3599c9ef 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -1564,7 +1564,7 @@ ngx_http_js_ext_next_arg(njs_vm_t *vm, njs_value_t *value, void *obj, ngx_str_t **e = next; size_t len; - u_char *p, *start, *end; + u_char *v, *p, *start, *end; ngx_str_t *entry; entry = *e; @@ -1576,17 +1576,19 @@ ngx_http_js_ext_next_arg(njs_vm_t *vm, njs_value_t *value, void *obj, start = entry->data; end = start + entry->len; - p = ngx_strlchr(start, end, '='); + p = ngx_strlchr(start, end, '&'); if (p == NULL) { - return NJS_ERROR; + p = end; } - len = p - start; - p++; + v = ngx_strlchr(start, p, '='); + if (v == NULL) { + v = p; + } - p = ngx_strlchr(p, end, '&'); + len = v - start; - if (p) { + if (p != end) { entry->data = &p[1]; entry->len = end - entry->data; -- 2.47.3