mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
getifaddrs() can return entries where ifa_addr is NULL. Check for this
before accessing anything in ifa_addr. ok claudio@
This commit is contained in:
parent
8435d35a4e
commit
44e7c9d580
@ -558,7 +558,8 @@ ifconfaddr(a)
|
||||
return (NULL);
|
||||
|
||||
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_addr->sa_family == AF_INET &&
|
||||
if (ifa->ifa_addr != NULL &&
|
||||
ifa->ifa_addr->sa_family == AF_INET &&
|
||||
((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == a) {
|
||||
strlcpy(ifname, ifa->ifa_name, sizeof(ifname));
|
||||
freeifaddrs(ifap);
|
||||
|
Loading…
Reference in New Issue
Block a user