diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:52:17 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:52:17 +0000 |
commit | 0a92c66511226fb388973a2df0c2cc35f77b4b8a (patch) | |
tree | 86e854371f626ba8902a84da37c5a2f801ee87bf /usr.bin/netstat | |
parent | b9d55859f451cbf1a0890ddeb4ea647c94dedd9e (diff) |
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr.
ok claudio@
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/route.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 9e8e22ba54b..5ae4751fe58 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.105 2020/06/12 06:22:32 remi Exp $ */ +/* $OpenBSD: route.c,v 1.106 2020/12/29 19:51:52 benno Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -368,7 +368,8 @@ rdomainpr(void) getifaddrs(&ifap); 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) continue; ifd = ifa->ifa_data; if (rdom_if[ifd->ifi_rdomain] == NULL) { |