fix segfault when the host has an addressless interface
@@ -1633,6 +1633,8 @@ int picoquic_getaddrs_v4(struct sockaddr_in *sas, int sas_length)
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+ /* What if an interface has no IP address? */
+ if (ifa->ifa_addr) {
family = ifa->ifa_addr->sa_family;
if (family == AF_INET) {
struct sockaddr_in *sai = (struct sockaddr_in *) ifa->ifa_addr;
@@ -1641,6 +1643,7 @@ int picoquic_getaddrs_v4(struct sockaddr_in *sas, int sas_length)
}
}
}
+ }
return count;
}
