diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:45:29 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2020-12-29 19:45:29 +0000 |
commit | 5958495968f77377c0374c74d54654e9c0101759 (patch) | |
tree | d965874f2d2123741b67eb7eb9aa880df698974a /usr.sbin/ospf6d | |
parent | 0b77da28e6632b8fcdcc05113a669995e8339d79 (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.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/parse.y | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y index f163e24149d..d49df81a81e 100644 --- a/usr.sbin/ospf6d/parse.y +++ b/usr.sbin/ospf6d/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.49 2020/01/21 20:38:52 remi Exp $ */ +/* $OpenBSD: parse.y,v 1.50 2020/12/29 19:44:26 benno Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -1253,7 +1253,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 */ |