summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-11-19 01:52:54 +0100
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-11-19 01:52:54 +0100
commit3f669049e77b87cca9168fbd55838bd679b573c4 (patch)
treeb0b8ccc37c7ca4cf383f1ba627329804cc137e51
parent749229fa367aed0bb14822a4e2fbbf112d06033e (diff)
downloadMAC-Telnet-3f669049e77b87cca9168fbd55838bd679b573c4.tar.gz
MAC-Telnet-3f669049e77b87cca9168fbd55838bd679b573c4.zip
Handle network devices without address information correctly.
-rw-r--r--devices.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/devices.c b/devices.c
index bb1822d..9fafdb7 100644
--- a/devices.c
+++ b/devices.c
@@ -124,7 +124,7 @@ int getIps(char *name, int nameLen, struct sockaddr_in *ip) {
if (int_cursor != NULL) {
while (int_cursor != NULL) {
dlAddr = (const struct sockaddr_in *) int_cursor->ifa_addr;
- if (dlAddr->sin_family == AF_INET) {
+ if (dlAddr != NULL && dlAddr->sin_family == AF_INET) {
memcpy(ip, dlAddr, sizeof(struct sockaddr_in));
strncpy(name, int_cursor->ifa_name, nameLen - 1);
name[nameLen - 1] = '\0';