WININET: lpvStatusInfo in INTERNET_STATUS_NAME_RESOLVED, INTERNET_STATUS_CONNECTING_TO_SERVER, and INTERNET_STATUS_CONNECTED_TO_SERVER should be strings, not sockaddr_in.

Robert Shearman rob at codeweavers.com
Sat Dec 31 11:06:57 CST 2005


Jacek Caban wrote:

>+    /* FIXME: inet_ntoa is not thread safe. */
>+    szaddr = WININET_strdup_AtoW(inet_ntoa(lpwhs->socketAddress.sin_addr));
>     INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
>                           INTERNET_STATUS_NAME_RESOLVED,
>-                          &(lpwhs->socketAddress),
>-                          sizeof(struct sockaddr_in));
>+                          szaddr, strlenW(szaddr));
>+    HeapFree(GetProcessHeap(), 0, szaddr);
>  
>

Like the comment says, it is not thread-safe. I don't think it is wise 
to delibrately introduce race conditions like this and it tends to cause 
problems with applications that rely heavily on multiple threads (such 
as iTunes). It would be better to use the thread-safe inet_ntop (which 
also has the bonus of supporting IPv6) or the ws2_32 version of inet_ntoa.

-- 
Rob Shearman




More information about the wine-devel mailing list