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: #47427
PR-URL: #53400
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
huseyinacacak-janea authored and marco-ippolito committed Jul 19, 2024
1 parent daab9e1 commit f773b28
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 @@ -188,7 +188,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 f773b28

Please sign in to comment.