summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-29 19:52:16 +0000
committerbenno <benno@openbsd.org>2020-12-29 19:52:16 +0000
commita54653fd88cab5ea6c54a17b21e530fd1dd6254c (patch)
tree99f4100845ca3748b47892afccf0c16c02c15f99
parentgetifaddrs() can return entries where ifa_addr is NULL. Check for this (diff)
downloadwireguard-openbsd-a54653fd88cab5ea6c54a17b21e530fd1dd6254c.tar.xz
wireguard-openbsd-a54653fd88cab5ea6c54a17b21e530fd1dd6254c.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.bin/rusers/rusers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
index 53f50a8ce6a..b8b4a399377 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rusers.c,v 1.42 2019/06/28 13:35:03 deraadt Exp $ */
+/* $OpenBSD: rusers.c,v 1.43 2020/12/29 19:52:16 benno Exp $ */
/*
* Copyright (c) 2001, 2003 Todd C. Miller <millert@openbsd.org>
@@ -558,7 +558,8 @@ allhosts(void)
*/
for (i = 0; i < 6; i++) {
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 ||
!(ifa->ifa_flags & IFF_BROADCAST) ||
!(ifa->ifa_flags & IFF_UP) ||
ifa->ifa_broadaddr == NULL ||