summaryrefslogtreecommitdiff
path: root/addrs_ioctl.c
diff options
context:
space:
mode:
authorpdw <>2011-10-02 21:14:14 +0000
committerpdw <>2011-10-02 21:14:14 +0000
commit3e90c6b54712eb4e361edc31526c058712df7988 (patch)
tree4bf4f808d7cd725f1c3ac29f262c1c26333cacb2 /addrs_ioctl.c
parentf1b9847302fafbab9b6b14b223db95579e025724 (diff)
downloadiftop-3e90c6b54712eb4e361edc31526c058712df7988.zip
Fixed segfault when selecting interfaces with empty MAC address (e.g. gprs
interface on Nokia N900) - Graham Ings <graham@nerve.org.za>
Diffstat (limited to 'addrs_ioctl.c')
-rw-r--r--addrs_ioctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/addrs_ioctl.c b/addrs_ioctl.c
index c68c50f..e86e2de 100644
--- a/addrs_ioctl.c
+++ b/addrs_ioctl.c
@@ -132,6 +132,9 @@ get_addrs_ioctl(char *interface, char if_hw_addr[], struct in_addr *if_ip_addr,
if (strcmp(ifa->ifa_name, interface))
continue; /* Not our interface. */
+ if (ifa->ifa_addr == NULL)
+ continue; /* Skip NULL interface address. */
+
if ( (ifa->ifa_addr->sa_family != AF_INET)
&& (ifa->ifa_addr->sa_family != AF_INET6) )
continue; /* AF_PACKET is beyond our scope. */