summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2009-11-01 18:19:14 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-11-19 16:34:19 +1000
commit2b9ad701967d6fd9c1d98e87ce94a806a05125e5 (patch)
tree39b2fdf6a4f026c16400e1f04f45d5cea737cc07 /os
parent71f4b404c0c5b4e8f41d779687e026efd580a988 (diff)
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 <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net> (cherry picked from commit 28eb61fc04811bb9bbb523e0a252933313bb16ce)
Diffstat (limited to 'os')
-rw-r--r--os/access.c3
1 files changed, 2 insertions, 1 deletions
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;