diff options
| author | 2020-12-29 19:50:51 +0000 | |
|---|---|---|
| committer | 2020-12-29 19:50:51 +0000 | |
| commit | 61791ef05918de39c9a2c96dca40b54231bb5f8e (patch) | |
| tree | c1d4391087fa03bfe8e1cbfd6f6530e514299d8a | |
| parent | getifaddrs() can return entries where ifa_addr is NULL. Check for this (diff) | |
| download | wireguard-openbsd-61791ef05918de39c9a2c96dca40b54231bb5f8e.tar.xz wireguard-openbsd-61791ef05918de39c9a2c96dca40b54231bb5f8e.zip | |
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr.
ok claudio@
| -rw-r--r-- | sbin/route/route.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index c13f5b6be07..9130b9ff692 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.250 2020/11/25 21:36:05 krw Exp $ */ +/* $OpenBSD: route.c,v 1.251 2020/12/29 19:50:51 benno Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -506,7 +506,8 @@ setsource(int argc, char **argv) for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (if_nametoindex(ifa->ifa_name) != ifindex) continue; - 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)) continue; if ((af != AF_UNSPEC) && |
