diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:51:16 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:51:16 +0000 |
commit | b9d55859f451cbf1a0890ddeb4ea647c94dedd9e (patch) | |
tree | 78d5736de8f06cf73cdd4bd997bff454fc4777fd /sbin/slaacd/frontend.c | |
parent | babb03929008ccd533d4228f0a32fc6ae523745b (diff) |
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr. florian@ mentioned this might
be a problem in slaacd(8) and rad(8) after claudio@ fixed it in bgpd,
so i went looking...
Diffstat (limited to 'sbin/slaacd/frontend.c')
-rw-r--r-- | sbin/slaacd/frontend.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c index 6bdfc92339d..7f45c8f7e5f 100644 --- a/sbin/slaacd/frontend.c +++ b/sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.42 2020/12/01 18:08:53 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.43 2020/12/29 19:51:15 benno Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -584,6 +584,8 @@ update_autoconf_addresses(uint32_t if_index, char* if_name) for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { if (strcmp(if_name, ifa->ifa_name) != 0) continue; + if (ifa->ifa_addr == NULL) + continue; if (ifa->ifa_addr->sa_family == AF_LINK) imsg_link_state.link_state = @@ -937,6 +939,8 @@ get_lladdr(char *if_name, struct ether_addr *mac, struct sockaddr_in6 *ll) for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { if (strcmp(if_name, ifa->ifa_name) != 0) continue; + if (ifa->ifa_addr == NULL) + continue; switch(ifa->ifa_addr->sa_family) { case AF_LINK: |