Skip to content

Commit 37cb863

Browse files
huseyinacacak-janeabmeck
authored andcommitted
src: fix IsIPAddress for IPv6
Fix the bug when copying IPv6 host to a variable to remove brackets. Fixes: nodejs#47427 PR-URL: nodejs#53400 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 6489142 commit 37cb863

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)