mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-18 05:53:36 +01:00
ifconfig: improve error checking for carp peer6
getaddrinfo() returns 0 if it succeeded, but it's not guaranteed to return 1 on error. Check for success rather than for one specific error. Without this fix commands such as `ifconfig bnxt1 inet6 add vhid 1 peer6 2001:db8::1/64` would segfault ifconfig. Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
2e6756b752
commit
2d9d97e66e
@ -237,7 +237,7 @@ setcarp_peer6(const char *val, int d, int s, const struct afswtch *afp)
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo(val, NULL, &hints, &res) == 1)
|
||||
if (getaddrinfo(val, NULL, &hints, &res) != 0)
|
||||
errx(1, "Invalid IPv6 address %s", val);
|
||||
|
||||
memcpy(&carp_addr6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
|
||||
|
Loading…
Reference in New Issue
Block a user