Commit ff01c2a1 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

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

parent 10b91549
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment