]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/ip_input.c
xnu-792.24.17.tar.gz
[apple/xnu.git] / bsd / netinet / ip_input.c
index 96ad70ed7a6a1542331a0601f25c3fc24ba1c967..f567de39e488da39e42a107375369d7d7feb5181 100644 (file)
@@ -2277,8 +2277,12 @@ ip_savecontrol(
                ifnet_head_lock_shared();
                if (((ifp = m->m_pkthdr.rcvif)) 
                && ( ifp->if_index && (ifp->if_index <= if_index))) {
-                       sdp = (struct sockaddr_dl *)(ifnet_addrs
-                                       [ifp->if_index - 1]->ifa_addr);
+                       struct ifaddr *ifa = ifnet_addrs[ifp->if_index - 1];
+                       
+                       if (!ifa || !ifa->ifa_addr)
+                               goto makedummy;
+                       
+                       sdp = (struct sockaddr_dl *)ifa->ifa_addr;
                        /*
                         * Change our mind and don't try copy.
                         */