ws2_32: Pass correct buffer length to WS_inet_ntop (Coverity).

This commit is contained in:
André Hentschel 2015-07-19 23:11:52 +02:00 committed by Alexandre Julliard
parent 10b91549ed
commit ff01c2a196
1 changed files with 3 additions and 1 deletions

View File

@ -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;