Skip to content

Commit 32188f8

Browse files
authored
optimize: fix potential null pointer dereference found by coverity (#9)
568 dd("array var map: array size: %d", (int) array->nelts); 569 CID 258181 (#1 of 1): Dereference null return value (NULL_RETURNS)7. dereference: Dereferencing array_it, which is known to be NULL. 570 array_it->not_found = 0; 571 array_it->valid = 1;
1 parent 353f916 commit 32188f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ngx_http_array_var_module.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ ngx_http_array_var_map(ngx_http_request_t *r, ngx_str_t *res,
553553
value = array->elts;
554554

555555
array_it = ngx_http_get_indexed_variable(r, conf->array_it_index);
556+
if (array_it == NULL) {
557+
return NGX_ERROR;
558+
}
556559

557560
if (conf->in_place) {
558561
new_array = array;

0 commit comments

Comments
 (0)