Skip to content

Commit

Permalink
purge report calloc fix
Browse files Browse the repository at this point in the history
Report template has not cache file path but it's length is use in buffer memory allocation
  • Loading branch information
tugrul authored and denji committed Jun 27, 2020
1 parent 75a854c commit e60093f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ngx_cache_purge_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r) {
r->headers_out.content_type.len = resp_ct_size - 1;
r->headers_out.content_type.data = (u_char *) resp_ct;

resp_tmpl_len = body_len + key[0].len + r->cache->file.name.len ;
resp_tmpl_len = body_len + key[0].len ;

buf = ngx_pcalloc(r->pool, resp_tmpl_len);
if (buf == NULL) {
Expand All @@ -1543,7 +1543,7 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}

len = body_len + key[0].len + r->cache->file.name.len;
len = body_len + key[0].len;

r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_length_n = len;
Expand Down

0 comments on commit e60093f

Please sign in to comment.