summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-30 18:39:57 +0000
committerbenno <benno@openbsd.org>2020-12-30 18:39:57 +0000
commitd35fe56c4cbe37882ff939d7a4c11b36b9eba765 (patch)
tree79b460aa3819b769489b4e07ee76280f5754462c
parentUse right format for session loop, GitHub issue 2519. (diff)
downloadwireguard-openbsd-d35fe56c4cbe37882ff939d7a4c11b36b9eba765.tar.xz
wireguard-openbsd-d35fe56c4cbe37882ff939d7a4c11b36b9eba765.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/eigrpd/parse.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/eigrpd/parse.y b/usr.sbin/eigrpd/parse.y
index f024e3cf0cd..02b0bcc31f2 100644
--- a/usr.sbin/eigrpd/parse.y
+++ b/usr.sbin/eigrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.30 2019/02/13 22:57:08 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.31 2020/12/30 18:39:57 benno Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -1246,7 +1246,8 @@ get_rtr_id(void)
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (strncmp(ifa->ifa_name, "carp", 4) == 0)
continue;
- if (ifa->ifa_addr->sa_family != AF_INET)
+ if (ifa->ifa_addr == NULL ||
+ ifa->ifa_addr->sa_family != AF_INET)
continue;
cur = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
if ((cur & localnet) == localnet) /* skip 127/8 */