Skip to content

Commit 0479297

Browse files
fdintinodenji
authored andcommitted
Fix segfault in cplcf->conf->purge_all with separate location syntax
cplcf->conf was not being set when using separate location purge syntax, so the attempt to access cplcf->conf->purge_all in ngx_http_cache_purge_handler was causing a segmentation fault.
1 parent 50eeab4 commit 0479297

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ngx_cache_purge_module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd,
387387
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
388388

389389
cplcf->fastcgi.enable = 0;
390+
cplcf->conf = &cplcf->fastcgi;
390391
clcf->handler = ngx_http_fastcgi_cache_purge_handler;
391392

392393
return NGX_CONF_OK;
@@ -673,6 +674,7 @@ ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
673674
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
674675

675676
cplcf->proxy.enable = 0;
677+
cplcf->conf = &cplcf->proxy;
676678
clcf->handler = ngx_http_proxy_cache_purge_handler;
677679

678680
return NGX_CONF_OK;
@@ -897,6 +899,7 @@ ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
897899
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
898900

899901
cplcf->scgi.enable = 0;
902+
cplcf->conf = &cplcf->scgi;
900903
clcf->handler = ngx_http_scgi_cache_purge_handler;
901904

902905
return NGX_CONF_OK;
@@ -1144,6 +1147,7 @@ ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
11441147
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
11451148

11461149
cplcf->uwsgi.enable = 0;
1150+
cplcf->conf = &cplcf->uwsgi;
11471151
clcf->handler = ngx_http_uwsgi_cache_purge_handler;
11481152

11491153
return NGX_CONF_OK;

0 commit comments

Comments
 (0)