Commit 6c824e8b authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

ws2_32: Return proper WSAENOBUFS error when enuming protocols.

parent 4565b4f4
......@@ -301,18 +301,16 @@ INT WINAPI WSAEnumProtocolsA( LPINT protocols, LPWSAPROTOCOL_INFOA buffer, LPDWO
DWORD size = 0;
INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 };
if (!buffer)
return SOCKET_ERROR;
if (!protocols) protocols = local;
while (protocols[i]) i++;
size = i * sizeof(WSAPROTOCOL_INFOA);
if (*len < size)
if (*len < size || !buffer)
{
*len = size;
WSASetLastError(WSAENOBUFS);
return SOCKET_ERROR;
}
......@@ -367,18 +365,16 @@ INT WINAPI WSAEnumProtocolsW( LPINT protocols, LPWSAPROTOCOL_INFOW buffer, LPDWO
DWORD size = 0;
INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 };
if (!buffer)
return SOCKET_ERROR;
if (!protocols) protocols = local;
while (protocols[i]) i++;
size = i * sizeof(WSAPROTOCOL_INFOW);
if (*len < size)
if (*len < size || !buffer)
{
*len = size;
WSASetLastError(WSAENOBUFS);
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