From fb14092fdc9281b96dd6cd9715c834e07618d9c2 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 10 Mar 2008 14:45:41 +0000 Subject: [PATCH] fix large memory allocation in "error_page 495-497 /uri" --- src/http/ngx_http_core_module.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 7f82d065d..08c1d352b 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -3559,7 +3559,22 @@ ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - err->overwrite = (overwrite >= 0) ? overwrite : err->status; + if (overwrite >= 0) { + err->overwrite = overwrite; + + } else { + switch (err->status) { + case NGX_HTTP_TO_HTTPS: + case NGX_HTTPS_CERT_ERROR: + case NGX_HTTPS_NO_CERT: + err->overwrite = NGX_HTTP_BAD_REQUEST; + break; + + default: + err->overwrite = err->status; + break; + } + } err->uri = uri; err->uri_lengths = uri_lengths;