diff --git a/src/ac/conf.c b/src/ac/conf.c index 4b62b592..53a5bb6f 100644 --- a/src/ac/conf.c +++ b/src/ac/conf.c @@ -362,6 +362,9 @@ static int init_listen_addrs() /* count the addresses */ int ctr = 0; for (ifa = ifap; ifa != 0; ifa = ifa->ifa_next) { + if (!ifa->ifa_addr) + continue; + if (ifa->ifa_addr->sa_family == AF_INET && conf_ipv4) ctr++; #ifdef WITH_IPV6 @@ -389,6 +392,8 @@ static int init_listen_addrs() continue; } } + if (!ifa->ifa_addr) + continue; if (ifa->ifa_addr->sa_family == AF_INET && conf_ipv4) { sock_addrtostr(ifa->ifa_addr, str, 100,0); @@ -493,6 +498,8 @@ int init_bcast_addrs() sa = ifa->ifa_addr; + if (!sa) + continue; if (sa->sa_family != AF_INET) continue; diff --git a/src/cw/sock_cmpaddr.c b/src/cw/sock_cmpaddr.c index 3a8d4812..07ff8581 100644 --- a/src/cw/sock_cmpaddr.c +++ b/src/cw/sock_cmpaddr.c @@ -47,6 +47,14 @@ int sock_cmpaddr(const struct sockaddr *addr1, const struct sockaddr *addr2,int int p1,p2; int slen; + if (!addr1){ + return -1; + } + + if (!addr2){ + return -1; + } + if (addr1->sa_family != addr2->sa_family){ return addr1->sa_family - addr2->sa_family; }