diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index c121579365055e..b6059b49410868 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -192,7 +192,7 @@ static bool IsIPAddress(const std::string& host) { // Parse the IPv6 address to ensure it is syntactically valid. char ipv6_str[INET6_ADDRSTRLEN]; std::copy(host.begin() + 1, host.end() - 1, ipv6_str); - ipv6_str[host.length()] = '\0'; + ipv6_str[host.length() - 2] = '\0'; unsigned char ipv6[sizeof(struct in6_addr)]; if (uv_inet_pton(AF_INET6, ipv6_str, ipv6) != 0) return false;