From a5e5458faffb5e6a3887f5cb389f372db826ec62 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 20 Oct 2008 18:35:28 +0200 Subject: [PATCH] Test if ifa_addr is NULL before using it. Thanks to Bjorn Mork for the patch. --- src/lldpd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; -- 2.47.2