From f4fd12acc873f37d54ede954eb7e48a684a7e9d0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 11 Oct 2007 18:03:12 -0700 Subject: Try and fix segfault found by Guenther on Fedora. Fedora seems to return bogus values for the interface entries on vmnet and tun interfaces. Jeremy. (This used to be commit 12c0b1d82802ccd1b272a8b47ddb7d258e10477c) --- source3/lib/interfaces.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/lib/interfaces.c') diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c index c56155c64e7..e98ea462827 100644 --- a/source3/lib/interfaces.c +++ b/source3/lib/interfaces.c @@ -135,11 +135,14 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces) memcpy(&ifaces[total].ip, ifptr->ifa_addr, copy_size); memcpy(&ifaces[total].netmask, ifptr->ifa_netmask, copy_size); - if (ifaces[total].flags & IFF_BROADCAST) { + + if ((ifaces[total].flags & IFF_BROADCAST) && + ifptr->ifa_broadaddr) { memcpy(&ifaces[total].bcast, ifptr->ifa_broadaddr, copy_size); - } else if (ifaces[total].flags & IFF_POINTOPOINT) { + } else if ((ifaces[total].flags & IFF_POINTOPOINT) && + ifptr->ifa_dstaddr ) { memcpy(&ifaces[total].bcast, ifptr->ifa_dstaddr, copy_size); -- cgit