From: paul Date: Tue, 17 Jan 2006 17:59:11 +0000 (+0000) Subject: [zebra] Defensive if_getaddrs bug fix. X-Git-Tag: frr-2.0-rc1~2784 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=61f42aed5e1cee1a853f92110d794a286995d203;p=matthieu%2Ffrr.git [zebra] Defensive if_getaddrs bug fix. 2006-01-17 Gunnar Stigen * if_ioctl.c: (if_getaddrs) Be defensive about assuming that struct ifaddrs will have ifa_addr filled in. --- diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 9c01492946..169f0a63ad 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -2,6 +2,8 @@ * connected.c: (connected_up_ipv{4,6}) Include interface metric on connected routes. + * if_ioctl.c: (if_getaddrs) Be defensive about assuming + that struct ifaddrs will have ifa_addr filled in. 2006-01-16 Paul Jakma diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index b00a29cdec..788184f8f4 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -228,6 +228,13 @@ if_getaddrs (void) for (ifapfree = ifap; ifap; ifap = ifap->ifa_next) { + if (ifap->ifa_addr == NULL) + { + zlog_err ("%s: nonsensical ifaddr with NULL ifa_addr, ifname %s", + __func__, (ifap->ifa_name ? ifap->ifa_name : "(null)")); + continue; + } + ifp = if_lookup_by_name (ifap->ifa_name); if (ifp == NULL) {