Core: fixed port handling in ngx_parse_inet6_url().

This fixes buffer over-read when no port is specified in cases
similar to 5df5d7d771f6, and catches missing port separator.
This commit is contained in:
Valentin Bartenev 2016-05-11 17:55:20 +03:00
parent 2a83e5fa6d
commit 66be8c6608

View File

@ -861,7 +861,12 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
last = uri;
}
if (*port == ':') {
if (port < last) {
if (*port != ':') {
u->err = "invalid host";
return NGX_ERROR;
}
port++;
len = last - port;