Changeset 3038 for pjproject/trunk


Ignore:
Timestamp:
Dec 29, 2009 5:37:51 PM (15 years ago)
Author:
bennylp
Message:

More ticket #1000:

  • fixed bug caused by r3030. If an adapter with NULL firstUnicastAddress is found, the function will return uninitialized array element.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ip_helper_win32.c

    r3033 r3038  
    276276        return PJ_RETURN_OS_ERROR(rc); 
    277277 
    278     for (i=0; i<*p_cnt && adapter; ++i, adapter = adapter->Next) { 
     278    for (i=0; i<*p_cnt && adapter; adapter = adapter->Next) { 
    279279        if (adapter->FirstUnicastAddress) { 
    280280            SOCKET_ADDRESS *pAddr = &adapter->FirstUnicastAddress->Address; 
    281             ifs[i].addr.sa_family = pAddr->lpSockaddr->sa_family; 
    282             pj_memcpy(&ifs[i], pAddr->lpSockaddr, pAddr->iSockaddrLength); 
     281            if (pAddr->lpSockaddr->sa_family == PJ_AF_INET || 
     282                pAddr->lpSockaddr->sa_family == PJ_AF_INET6) 
     283            { 
     284                ifs[i].addr.sa_family = pAddr->lpSockaddr->sa_family; 
     285                pj_memcpy(&ifs[i], pAddr->lpSockaddr, pAddr->iSockaddrLength); 
     286                ++i; 
     287            } 
    283288        } 
    284289    } 
Note: See TracChangeset for help on using the changeset viewer.