summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2009-11-01 18:19:14 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2009-11-09 20:33:40 +0000
commit28eb61fc04811bb9bbb523e0a252933313bb16ce (patch)
treedd9a23b5d3f620601c542062709eebdb84346cb8 /os
parent091cbbaed7aafab6f9839a40fe977ab067d1ace1 (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>
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;