Skip to content

Commit

Permalink
src: fix IsIPAddress for IPv6
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
huseyinacacak-janea authored and eliphazbouye committed Jun 20, 2024
1 parent 386c6da commit 05bb310
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/inspector_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 05bb310

Please sign in to comment.