changeset 7028:e6f399a176e7

Userid: ngx_http_get_indexed_variable() error handling. 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.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 07 Jun 2017 18:46:36 +0300
parents 6d0e0d982ec0
children 3c55863e6887
files src/http/modules/ngx_http_userid_filter_module.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -472,6 +472,10 @@ ngx_http_userid_create_uid(ngx_http_requ
 
         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'