From 28eb61fc04811bb9bbb523e0a252933313bb16ce Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 1 Nov 2009 18:19:14 +0000 Subject: [PATCH] Avoid a null dereference if IFF_BROADCAST is set but there is no broadcast address It seems that the getifaddrs() function can return interfaces with IFF_BROADCAST & IFF_UP set, but no broadcast address (at least under Cygwin 1.7, this seems to happen for v6 mapped v4 addresses) Avoid a null dereference if this ever happens Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- os/access.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/os/access.c b/os/access.c index 8c5b50af0..2a171fa70 100644 --- a/os/access.c +++ b/os/access.c @@ -811,7 +811,8 @@ DefineSelf (int fd) continue; #endif if ((ifr->ifa_flags & IFF_BROADCAST) && - (ifr->ifa_flags & IFF_UP)) + (ifr->ifa_flags & IFF_UP) && + ifr->ifa_broadaddr) broad_addr = *ifr->ifa_broadaddr; else continue;