mirror of
https://github.com/nginx/nginx.git
synced 2024-12-27 17:31:35 -06:00
Disabled redirects to named locations if URI is not set.
If something like "error_page 400 @name" is used in a configuration, a request could be passed to a named location without URI set, and this in turn might result in segmentation faults or other bad effects as most of the code assumes URI is set. With this change nginx will catch such configuration problems in ngx_http_named_location() and will stop request processing if URI is not set, returning 500.
This commit is contained in:
parent
8aa8365121
commit
96af3e9dfb
@ -2632,6 +2632,14 @@ ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name)
|
||||
return NGX_DONE;
|
||||
}
|
||||
|
||||
if (r->uri.len == 0) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"empty URI in redirect to named location \"%V\"", name);
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_DONE;
|
||||
}
|
||||
|
||||
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
||||
|
||||
if (cscf->named_locations) {
|
||||
|
Loading…
Reference in New Issue
Block a user