From 96c796ea3f16c4187623c86aa709b08362521155 Mon Sep 17 00:00:00 2001 From: ru Date: Mon, 14 Nov 2005 18:19:57 +0000 Subject: Unlike the rest of the world, NDIS code can access "struct ifnet" before is has been fully initialized by if_attach(). Account for that to avoid a null pointer dereference. --- sys/compat/ndis/subr_ndis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index de50ce3..4ce9259 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -1410,7 +1410,8 @@ NdisReadNetworkAddress(status, addr, addrlen, adapter) #ifdef IFP2ENADDR if (bcmp(IFP2ENADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) #elif __FreeBSD_version >= 700000 - if (bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) + if (sc->ifp->if_addr == NULL || + bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) #else if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0) #endif -- cgit v1.1