]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Test if ifa_addr is NULL before using it.
authorVincent Bernat <vbernat@wanadooportails.com>
Mon, 20 Oct 2008 16:35:28 +0000 (18:35 +0200)
committerVincent Bernat <vbernat@wanadooportails.com>
Mon, 20 Oct 2008 16:35:28 +0000 (18:35 +0200)
Thanks to Bjorn Mork for the patch.

src/lldpd.c

index 3f4ea32e0addae1faaec9266879f8eb038cb2367..697bd06bb05861670f9139716f16e767f2951483 100644 (file)
@@ -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;