mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 06:40:26 +00:00
net: get_local_addresses - ifaddrs.ifa_addr can be NULL
The pointer ifa_addr in struct ifaddrs can be NULL and indeed it occurs (perhaps with interfaces without assigned addrs?). Steps to reproduce: ``` uv -x sdp -t testcard -c lavc:subs=420 ````
This commit is contained in:
@@ -315,6 +315,10 @@ bool get_local_addresses(struct sockaddr_storage *addrs, size_t *len, int ip_ver
|
||||
getifaddrs(&a);
|
||||
struct ifaddrs* p = a;
|
||||
while (NULL != p) {
|
||||
if (p->ifa_addr == NULL) {
|
||||
p = p->ifa_next;
|
||||
continue;
|
||||
}
|
||||
if ((ip_version == 0 && (p->ifa_addr->sa_family == AF_INET || p->ifa_addr->sa_family == AF_INET6)) ||
|
||||
(ip_version == 4 && p->ifa_addr->sa_family == AF_INET) ||
|
||||
(ip_version == 6 && p->ifa_addr->sa_family == AF_INET6)) {
|
||||
|
||||
Reference in New Issue
Block a user