summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-30 18:46:55 +0000
committerbenno <benno@openbsd.org>2020-12-30 18:46:55 +0000
commit44e7c9d5801a1e72e3ff8b8261c49e31e9f4069b (patch)
treef46c954511d5ceba73a566a9827bd976f4c3c93f
parentgetifaddrs() can return entries where ifa_addr is NULL. Check for this (diff)
downloadwireguard-openbsd-44e7c9d5801a1e72e3ff8b8261c49e31e9f4069b.tar.xz
wireguard-openbsd-44e7c9d5801a1e72e3ff8b8261c49e31e9f4069b.zip
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr. ok claudio@
-rw-r--r--usr.sbin/mrouted/cfparse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y
index 0b8af93ea21..bf06644987c 100644
--- a/usr.sbin/mrouted/cfparse.y
+++ b/usr.sbin/mrouted/cfparse.y
@@ -558,7 +558,8 @@ ifconfaddr(a)
return (NULL);
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr->sa_family == AF_INET &&
+ if (ifa->ifa_addr != NULL &&
+ ifa->ifa_addr->sa_family == AF_INET &&
((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == a) {
strlcpy(ifname, ifa->ifa_name, sizeof(ifname));
freeifaddrs(ifap);