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/ospfd | |
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/ospfd')
-rw-r--r-- | usr.sbin/ospfd/parse.y | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index a09696504f8..3e05873211a 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.100 2020/01/21 20:38:52 remi Exp $ */ +/* $OpenBSD: parse.y,v 1.101 2020/12/29 19:44:47 benno Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -1469,7 +1469,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 */ |