summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-30 18:40:44 +0000
committerbenno <benno@openbsd.org>2020-12-30 18:40:44 +0000
commit0aada395ef1976f4354bf8f63f39d652779b7adb (patch)
treea0c57d7148b8d35c9fb623c6cab6e466697f635e
parentgetifaddrs() can return entries where ifa_addr is NULL. Check for this (diff)
downloadwireguard-openbsd-0aada395ef1976f4354bf8f63f39d652779b7adb.tar.xz
wireguard-openbsd-0aada395ef1976f4354bf8f63f39d652779b7adb.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/ifstated/ifstated.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c
index 225f5aaa9e0..7d6ba2fae07 100644
--- a/usr.sbin/ifstated/ifstated.c
+++ b/usr.sbin/ifstated/ifstated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifstated.c,v 1.64 2019/06/28 13:32:47 deraadt Exp $ */
+/* $OpenBSD: ifstated.c,v 1.65 2020/12/30 18:40:44 benno Exp $ */
/*
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -642,7 +642,8 @@ fetch_ifstate(int do_eval)
fatal("getifaddrs");
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr->sa_family == AF_LINK) {
+ if (ifa->ifa_addr != NULL &&
+ ifa->ifa_addr->sa_family == AF_LINK) {
struct if_data *ifdata = ifa->ifa_data;
scan_ifstate(ifa->ifa_name, ifdata->ifi_link_state,
do_eval);