diff options
author | Axel Duch <axel.duch@nginx.com> | 2020-01-28 15:05:12 +0000 |
---|---|---|
committer | Axel Duch <axel.duch@nginx.com> | 2020-01-28 15:05:12 +0000 |
commit | 4eb2d3086b4abbcbf6c81170bcf7b9ccefd05428 (patch) | |
tree | 451e93c05bd1c1cd1ab3d38932b77e59cfaf6a17 | |
parent | 1451090d85db4152ba432b45d2e164b4f76bc80c (diff) | |
download | unit-4eb2d3086b4abbcbf6c81170bcf7b9ccefd05428.tar.gz unit-4eb2d3086b4abbcbf6c81170bcf7b9ccefd05428.tar.bz2 |
Fixed missing IPv6 checking in route-addr and an unused variable.
This closes #363 issue on Github.
Thanks to to 洪志道 (Hong Zhi Dao).
-rw-r--r-- | src/nxt_http_route_addr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nxt_http_route_addr.c b/src/nxt_http_route_addr.c index 3c7e9c84..6d4955ed 100644 --- a/src/nxt_http_route_addr.c +++ b/src/nxt_http_route_addr.c @@ -18,7 +18,7 @@ nxt_int_t nxt_http_route_addr_pattern_parse(nxt_mp_t *mp, nxt_http_route_addr_pattern_t *pattern, nxt_conf_value_t *cv) { - u_char *delim, *end; + u_char *delim; nxt_int_t ret, cidr_prefix; nxt_str_t addr, port; nxt_http_route_addr_base_t *base; @@ -59,6 +59,7 @@ nxt_http_route_addr_pattern_parse(nxt_mp_t *mp, if (nxt_str_looks_like_ipv6(&addr)) { #if (NXT_INET6) + u_char *end; uint8_t i; nxt_int_t len; nxt_http_route_in6_addr_range_t *inet6; @@ -179,7 +180,10 @@ nxt_http_route_addr_pattern_parse(nxt_mp_t *mp, return NXT_ADDR_PATTERN_FORMAT_ERROR; } - nxt_inet6_addr(&inet6->start, addr.start, addr.length); + ret = nxt_inet6_addr(&inet6->start, addr.start, addr.length); + if (nxt_slow_path(ret != NXT_OK)) { + return NXT_ADDR_PATTERN_FORMAT_ERROR; + } goto parse_port; #endif |