Check if ifa_addr field is null.
This field can be null. See e.g. https://man7.org/linux/man-pages/man3/getifaddrs.3.html Bug: webrtc:12523 Change-Id: I63ba297d0c57b3b70c545d1434716094d8ce20a4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212601 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33517}
This commit is contained in:
committed by
Commit Bot
parent
76b51e21bc
commit
ebd20109f0
@ -53,7 +53,7 @@ bool HasIPv4Enabled() {
|
||||
return false;
|
||||
}
|
||||
for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) {
|
||||
if (cur->ifa_addr->sa_family == AF_INET) {
|
||||
if (cur->ifa_addr != nullptr && cur->ifa_addr->sa_family == AF_INET) {
|
||||
has_ipv4 = true;
|
||||
break;
|
||||
}
|
||||
@ -112,7 +112,7 @@ bool HasIPv6Enabled() {
|
||||
return false;
|
||||
}
|
||||
for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) {
|
||||
if (cur->ifa_addr->sa_family == AF_INET6) {
|
||||
if (cur->ifa_addr != nullptr && cur->ifa_addr->sa_family == AF_INET6) {
|
||||
has_ipv6 = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user