getifaddrs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Version: manpages-dev 3.27-1ubuntu2


The example program source produces a Seg-Fault, when a device does not have an ifa->ifa_addr. (e.g. openvpn-tunnels, probably others (dialup?))


ORIGINAL:
           for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
               family = ifa->ifa_addr->sa_family;


POSSIBLE FIX:
           for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
		if (ifa->ifa_addr != NULL)
               		family = ifa->ifa_addr->sa_family;
		else
			family = -1;


Also it is not documented, that  struct sockaddr *ifa_addr  might be NULL.


best wishes and keep up the good work,
Adrian Dabrowski
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux