iphlpapi: Don't crash when enumerating PtP interfaces.

This commit is contained in:
Michael Stefaniuc 2010-03-16 01:09:40 +01:00 committed by Alexandre Julliard
parent 914472ab81
commit 0bbce793c3
1 changed files with 4 additions and 2 deletions

View File

@ -807,7 +807,8 @@ ULONG v6addressesFromIndex(DWORD index, SOCKET_ADDRESS **addrs, ULONG *num_addrs
getInterfaceNameByIndex(index, name);
for (p = ifa, n = 0; p; p = p->ifa_next)
if (p->ifa_addr->sa_family == AF_INET6 && !strcmp(name, p->ifa_name))
if (p->ifa_addr && p->ifa_addr->sa_family == AF_INET6 &&
!strcmp(name, p->ifa_name))
n++;
if (n)
{
@ -820,7 +821,8 @@ ULONG v6addressesFromIndex(DWORD index, SOCKET_ADDRESS **addrs, ULONG *num_addrs
for (p = ifa, n = 0; p; p = p->ifa_next)
{
if (p->ifa_addr->sa_family == AF_INET6 && !strcmp(name, p->ifa_name))
if (p->ifa_addr && p->ifa_addr->sa_family == AF_INET6 &&
!strcmp(name, p->ifa_name))
{
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)p->ifa_addr;