aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-12-15 10:24:57 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-12-15 10:24:57 +0000
commit03011fa512bc04879f17774450712dade3dc77b9 (patch)
treed512e27f0288cf3f1faa470f7e053dfaec5534ae /src/http/ngx_http_variables.c
parentc996d3250d2bb7758afd3601b080bf7d04744e3f (diff)
downloadnginx-03011fa512bc04879f17774450712dade3dc77b9.tar.gz
nginx-03011fa512bc04879f17774450712dade3dc77b9.zip
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
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index c31defc4e..ab43638f6 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -678,9 +678,13 @@ ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v,
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;