Skip to content

Commit 50eeab4

Browse files
fdintinodenji
authored andcommitted
Fix segfault in call to ngx_read_file of partial key purge
Because file.log is not initialized and the file variable is not zeroed out after initialization, the call to ngx_log_error_core in ngx_read_file results in a segmentation fault.
1 parent 8d655ac commit 50eeab4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ngx_cache_purge_module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,9 +1249,11 @@ ngx_http_purge_file_cache_delete_partial_file(ngx_tree_ctx_t *ctx, ngx_str_t *pa
12491249
} else {
12501250
ngx_file_t file;
12511251

1252+
ngx_memzero(&file, sizeof(ngx_file_t));
12521253
file.offset = file.sys_offset = 0;
12531254
file.fd = ngx_open_file(path->data, NGX_FILE_RDONLY, NGX_FILE_OPEN,
12541255
NGX_FILE_DEFAULT_ACCESS);
1256+
file.log = ctx->log;
12551257

12561258
/* I don't know if it's a good idea to use the ngx_cycle pool for this,
12571259
but the request is not available here */

0 commit comments

Comments
 (0)