summaryrefslogtreecommitdiffstats
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2020-12-29 19:50:28 +0000
committerbenno <benno@openbsd.org>2020-12-29 19:50:28 +0000
commitff7f497850d580cf58e097deed82ec8e46cd647c (patch)
tree9346c174ac6793b77ffc915534a5a8e29a65014f /sbin/pfctl
parentgetifaddrs() can return entries where ifa_addr is NULL. Check for this (diff)
downloadwireguard-openbsd-ff7f497850d580cf58e097deed82ec8e46cd647c.tar.xz
wireguard-openbsd-ff7f497850d580cf58e097deed82ec8e46cd647c.zip
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr. ok claudio@
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl_parser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 32b14d8b4cb..03317844e91 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.343 2020/05/15 00:56:03 cheloha Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.344 2020/12/29 19:50:28 benno Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1352,7 +1352,8 @@ ifa_load(void)
err(1, "getifaddrs");
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_addr->sa_family == AF_INET6 ||
ifa->ifa_addr->sa_family == AF_LINK))
continue;