ws2_32: Pass correct buffer length to WS_inet_ntop (Coverity).
This commit is contained in:
parent
10b91549ed
commit
ff01c2a196
|
@ -7663,12 +7663,14 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len,
|
|||
case WS_AF_INET6:
|
||||
{
|
||||
struct WS_sockaddr_in6 *sockaddr6 = (LPSOCKADDR_IN6) sockaddr;
|
||||
size_t slen;
|
||||
|
||||
buffer[0] = 0;
|
||||
if (len < sizeof(SOCKADDR_IN6)) return SOCKET_ERROR;
|
||||
if ((sockaddr6->sin6_port))
|
||||
strcpy(buffer, "[");
|
||||
if (!WS_inet_ntop(WS_AF_INET6, &sockaddr6->sin6_addr, buffer+strlen(buffer), sizeof(buffer)))
|
||||
slen = strlen(buffer);
|
||||
if (!WS_inet_ntop(WS_AF_INET6, &sockaddr6->sin6_addr, &buffer[slen], sizeof(buffer) - slen))
|
||||
{
|
||||
SetLastError(WSAEINVAL);
|
||||
return SOCKET_ERROR;
|
||||
|
|
Loading…
Reference in New Issue