Commit 79387b2f authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Forbid passing zero buffers to WSARecv().

parent 9df04bfd
......@@ -4035,6 +4035,12 @@ int WINAPI WSARecv(SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
{
if (!dwBufferCount)
{
SetLastError( WSAEINVAL );
return -1;
}
return WS2_recv_base(s, lpBuffers, dwBufferCount, NumberOfBytesReceived, lpFlags,
NULL, NULL, lpOverlapped, lpCompletionRoutine, NULL);
}
......
......@@ -12811,14 +12811,14 @@ static void test_empty_recv(void)
WSASetLastError(0xdeadbeef);
ret = WSARecv(client, NULL, 0, NULL, &flags, &overlapped, NULL);
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
wsabuf.buf = buffer;
wsabuf.len = 0;
WSASetLastError(0xdeadbeef);
ret = WSARecv(client, &wsabuf, 0, NULL, &flags, &overlapped, NULL);
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef);
ret = WSARecv(client, &wsabuf, 1, NULL, &flags, &overlapped, NULL);
......
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