[nginx] Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.

Maxim Dounin mdounin at mdounin.ru
Tue Sep 29 13:18:12 UTC 2020


details:   https://hg.nginx.org/nginx/rev/a88384c69d1e
branches:  
changeset: 7720:a88384c69d1e
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Sep 29 15:54:09 2020 +0300
description:
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.

Found by Coverity (CID 1467637).

diffstat:

 src/http/modules/ngx_http_proxy_module.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r c0cacad62cc8 -r a88384c69d1e src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c	Tue Sep 29 15:52:18 2020 +0300
+++ b/src/http/modules/ngx_http_proxy_module.c	Tue Sep 29 15:54:09 2020 +0300
@@ -2679,7 +2679,9 @@ ngx_http_proxy_rewrite_cookie(ngx_http_r
     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;


More information about the nginx-devel mailing list