From: Vincent Bernat Date: Mon, 20 Oct 2008 16:35:28 +0000 (+0200) Subject: Test if ifa_addr is NULL before using it. X-Git-Tag: 0.2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5e5458faffb5e6a3887f5cb389f372db826ec62;p=thirdparty%2Flldpd.git Test if ifa_addr is NULL before using it. Thanks to Bjorn Mork for the patch. --- diff --git a/src/lldpd.c b/src/lldpd.c index 3f4ea32e..697bd06b 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -1438,6 +1438,10 @@ lldpd_loop(struct lldpd *cfg) } } + if (ifa->ifa_addr == NULL || + ifa->ifa_addr->sa_family != PF_PACKET) + continue; + sdl = (struct sockaddr_ll *)ifa->ifa_addr; if (sdl->sll_hatype != ARPHRD_ETHER || !sdl->sll_halen) continue; @@ -1451,10 +1455,6 @@ lldpd_loop(struct lldpd *cfg) (iface_is_bond(cfg, ifa->ifa_name))) continue; - if (ifa->ifa_addr == NULL || - ifa->ifa_addr->sa_family != PF_PACKET) - continue; - if (!(ifa->ifa_flags & IFF_MULTICAST)) continue;