comparison src/http/ngx_http_core_module.c @ 5584:0251f2f1dc93

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 27 Feb 2014 20:36:35 +0400
parents 692afcea9d0d
children 3a72b1805c52
comparison
equal deleted inserted replaced
5583:f47c844acbd4 5584:0251f2f1dc93
2625 2625
2626 if (r->uri_changes == 0) { 2626 if (r->uri_changes == 0) {
2627 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 2627 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2628 "rewrite or internal redirection cycle " 2628 "rewrite or internal redirection cycle "
2629 "while redirect to named location \"%V\"", name); 2629 "while redirect to named location \"%V\"", name);
2630
2631 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2632 return NGX_DONE;
2633 }
2634
2635 if (r->uri.len == 0) {
2636 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2637 "empty URI in redirect to named location \"%V\"", name);
2630 2638
2631 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 2639 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2632 return NGX_DONE; 2640 return NGX_DONE;
2633 } 2641 }
2634 2642