Skip to content

Commit

Permalink
Access log: fix default value, broken by cb308813b453.
Browse files Browse the repository at this point in the history
log->filter ("if" parameter) was uninitialized when the default value
was being used, which would lead to a crash (SIGSEGV) when access_log
directive wasn't specified in the configuration.

Zero-fill the whole structure instead of zeroing fields one-by-one
in order to prevent similar issues in the future.

Signed-off-by: Piotr Sikora <[email protected]>
  • Loading branch information
PiotrSikora committed Jun 3, 2014
1 parent afb4aaf commit a1a8def
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/http/modules/ngx_http_log_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,16 +1109,13 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}

ngx_memzero(log, sizeof(ngx_http_log_t));

log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
if (log->file == NULL) {
return NGX_CONF_ERROR;
}

log->script = NULL;
log->disk_full_time = 0;
log->error_log_time = 0;
log->syslog_peer = NULL;

lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
fmt = lmcf->formats.elts;

Expand Down

0 comments on commit a1a8def

Please sign in to comment.