Skip to content

Commit 73fa9ab

Browse files
src: fix IsIPAddress for IPv6
Fix the bug when copying IPv6 host to a variable to remove brackets. Fixes: #47427 PR-URL: #53400 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 937ae10 commit 73fa9ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/inspector_socket.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static bool IsIPAddress(const std::string& host) {
192192
// Parse the IPv6 address to ensure it is syntactically valid.
193193
char ipv6_str[INET6_ADDRSTRLEN];
194194
std::copy(host.begin() + 1, host.end() - 1, ipv6_str);
195-
ipv6_str[host.length()] = '\0';
195+
ipv6_str[host.length() - 2] = '\0';
196196
unsigned char ipv6[sizeof(struct in6_addr)];
197197
if (uv_inet_pton(AF_INET6, ipv6_str, ipv6) != 0) return false;
198198

0 commit comments

Comments
 (0)