Mercurial > hg > nginx
changeset 928:a6fe6bedb9e3
fix segfault when $host is used and
*) request is "GET http://host" without CR or LF, or timed out
*) request is "GET http://host" with a large blank space
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 15 Dec 2006 10:24:57 +0000 |
parents | 4f3d57408877 |
children | 1adfc55bb6dc |
files | src/http/ngx_http_request.c src/http/ngx_http_variables.c |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_request.c Thu Dec 14 23:22:34 2006 +0000 +++ b/src/http/ngx_http_request.c Fri Dec 15 10:24:57 2006 +0000 @@ -1104,7 +1104,9 @@ if (r->host_start) { r->host_start = new + (r->host_start - old); - r->host_end = new + (r->host_end - old); + if (r->host_end) { + r->host_end = new + (r->host_end - old); + } } if (r->port_start) {
--- a/src/http/ngx_http_variables.c Thu Dec 14 23:22:34 2006 +0000 +++ b/src/http/ngx_http_variables.c Fri Dec 15 10:24:57 2006 +0000 @@ -678,9 +678,13 @@ v->data = r->server_name.data; } - } else { + } else if (r->host_end) { v->len = r->host_end - r->host_start; v->data = r->host_start; + + } else { + v->not_found = 1; + return NGX_OK; } v->valid = 1;