diff options
author | Sree Kuchibhotla <sreek@google.com> | 2018-08-30 11:37:34 -0700 |
---|---|---|
committer | Sree Kuchibhotla <sreek@google.com> | 2018-08-30 11:37:34 -0700 |
commit | 7269fd47eb12f9383535c657b855286cd4570d9f (patch) | |
tree | 8b65191bd1f33f3ef1fb16830a5e85b273e4bc21 /src/core/ext/filters/client_channel/parse_address.cc | |
parent | ee65a5eaee45a765d1d4176a797bb8288faeb180 (diff) |
Fix ipv6 address parsing issue
Diffstat (limited to 'src/core/ext/filters/client_channel/parse_address.cc')
-rw-r--r-- | src/core/ext/filters/client_channel/parse_address.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc index b3900114ad..5eeea1b148 100644 --- a/src/core/ext/filters/client_channel/parse_address.cc +++ b/src/core/ext/filters/client_channel/parse_address.cc @@ -128,6 +128,13 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr, char host_without_scope[GRPC_INET6_ADDRSTRLEN]; size_t host_without_scope_len = static_cast<size_t>(host_end - host); uint32_t sin6_scope_id = 0; + if (host_without_scope_len > GRPC_INET6_ADDRSTRLEN) { + gpr_log(GPR_ERROR, + "invalid ipv6 address length %d. Length cannot be greater than " + "GRPC_INET6_ADDRSTRLEN i.e %d)", + host_without_scope_len, GRPC_INET6_ADDRSTRLEN); + goto done; + } strncpy(host_without_scope, host, host_without_scope_len); host_without_scope[host_without_scope_len] = '\0'; if (grpc_inet_pton(GRPC_AF_INET6, host_without_scope, &in6->sin6_addr) == |