]> git.kaiwu.me - nginx.git/commitdiff
Userid: ngx_http_get_indexed_variable() error handling.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 15:46:36 +0000 (18:46 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 15:46:36 +0000 (18:46 +0300)
When evaluating a mapped $reset_uid variable in the userid filter,
if get_handler set to ngx_http_map_variable() returned an error,
this previously resulted in a NULL pointer dereference.

src/http/modules/ngx_http_userid_filter_module.c

index 0dbacba087c2e0892e21eb5b23446073e086c716..a1a54936bd676c2d4d668cefcf5bfb4bfdc63f28 100644 (file)
@@ -472,6 +472,10 @@ ngx_http_userid_create_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
 
         vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);
 
+        if (vv == NULL || vv->not_found) {
+            return NGX_ERROR;
+        }
+
         if (vv->len == 0 || (vv->len == 1 && vv->data[0] == '0')) {
 
             if (conf->mark == '\0'