Skip to content

Commit

Permalink
empty key check
Browse files Browse the repository at this point in the history
it coredumps when cache key is empty
  • Loading branch information
tugrul authored and denji committed Jun 27, 2020
1 parent 7faf290 commit a6df03c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ngx_cache_purge_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,9 @@ ngx_http_cache_purge_is_partial(ngx_http_request_t *r) {
key = c->keys.elts;

/* Only check the first key */
return key[0].data[key[0].len - 1] == '*';
return c->keys.nelts > 0 // number of array elements
&& key[0].len > 0 // char length of the key
&& key[0].data[key[0].len - 1] == '*'; // is the last char an asterix char?
}

char *
Expand Down

0 comments on commit a6df03c

Please sign in to comment.