Mercurial > hg > nginx
changeset 4636:ed957e0daeb4
Capped the status code that may be returned with "return" and "try_files".
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 16 May 2012 13:22:03 +0000 |
parents | 9c9fbdbe9383 |
children | 668ab1a21327 |
files | src/http/modules/ngx_http_rewrite_module.c src/http/ngx_http_core_module.c |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_rewrite_module.c Wed May 16 13:14:53 2012 +0000 +++ b/src/http/modules/ngx_http_rewrite_module.c Wed May 16 13:22:03 2012 +0000 @@ -485,6 +485,12 @@ } else { + if (ret->status > 999) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid return code \"%V\"", &value[1]); + return NGX_CONF_ERROR; + } + if (cf->args->nelts == 2) { return NGX_CONF_OK; }
--- a/src/http/ngx_http_core_module.c Wed May 16 13:14:53 2012 +0000 +++ b/src/http/ngx_http_core_module.c Wed May 16 13:22:03 2012 +0000 @@ -4662,7 +4662,7 @@ code = ngx_atoi(tf[i - 1].name.data + 1, tf[i - 1].name.len - 2); - if (code == NGX_ERROR) { + if (code == NGX_ERROR || code > 999) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid code \"%*s\"", tf[i - 1].name.len - 1, tf[i - 1].name.data);