]> git.kaiwu.me - nginx.git/commitdiff
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 29 Sep 2020 12:54:09 +0000 (15:54 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 29 Sep 2020 12:54:09 +0000 (15:54 +0300)
Found by Coverity (CID 1467637).

src/http/modules/ngx_http_proxy_module.c

index 17e4761c651e14c9537ed020f80cdbfa8d379a8d..c5c9e8587c99ac546030c112a4a220d3eca0dfd5 100644 (file)
@@ -2679,7 +2679,9 @@ ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r, ngx_table_elt_t *h)
     ngx_keyval_t               *attr;
     ngx_http_proxy_loc_conf_t  *plcf;
 
-    ngx_array_init(&attrs, r->pool, 2, sizeof(ngx_keyval_t));
+    if (ngx_array_init(&attrs, r->pool, 2, sizeof(ngx_keyval_t)) != NGX_OK) {
+        return NGX_ERROR;
+    }
 
     if (ngx_http_proxy_parse_cookie(&h->value, &attrs) != NGX_OK) {
         return NGX_ERROR;