From 86dd5bde4590e60289cf2ae94afe2f9ab5d65f3c Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 8 Aug 2012 12:03:46 +0000 Subject: [PATCH] Added three missing checks for NULL after ngx_array_push() calls. Found by Coverity. --- src/http/modules/ngx_http_fastcgi_module.c | 3 +++ src/http/modules/ngx_http_limit_conn_module.c | 4 ++++ src/http/modules/ngx_http_limit_req_module.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index 55c3aef29..e8ff24cac 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -1626,6 +1626,9 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r) } part = ngx_array_push(f->split_parts); + if (part == NULL) { + return NGX_ERROR; + } part->start = part_start; part->end = part_end; diff --git a/src/http/modules/ngx_http_limit_conn_module.c b/src/http/modules/ngx_http_limit_conn_module.c index 106da7a53..e82ca493d 100644 --- a/src/http/modules/ngx_http_limit_conn_module.c +++ b/src/http/modules/ngx_http_limit_conn_module.c @@ -721,6 +721,10 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } limit = ngx_array_push(&lccf->limits); + if (limit == NULL) { + return NGX_CONF_ERROR; + } + limit->conn = n; limit->shm_zone = shm_zone; diff --git a/src/http/modules/ngx_http_limit_req_module.c b/src/http/modules/ngx_http_limit_req_module.c index 18db71549..3f9910e71 100644 --- a/src/http/modules/ngx_http_limit_req_module.c +++ b/src/http/modules/ngx_http_limit_req_module.c @@ -937,6 +937,9 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } limit = ngx_array_push(&lrcf->limits); + if (limit == NULL) { + return NGX_CONF_ERROR; + } limit->shm_zone = shm_zone; limit->burst = burst * 1000;