Commit 3c64a7c4 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Fix some parameters checking in AcceptEx.

parent b3d07c78
......@@ -2386,10 +2386,9 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
return FALSE;
}
if ((local_addr_len < sizeof(struct sockaddr_in) + 16)
|| (rem_addr_len < sizeof(struct sockaddr_in) + 16))
if (!rem_addr_len)
{
SetLastError(WSAEINVAL);
SetLastError(WSAEFAULT);
return FALSE;
}
......@@ -2404,7 +2403,7 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
fd = get_sock_fd( acceptor, FILE_READ_DATA, NULL );
if (fd == -1)
{
SetLastError(WSAEINVAL);
SetLastError(WSAENOTSOCK);
return FALSE;
}
release_sock_fd( acceptor, fd );
......
......@@ -5935,8 +5935,7 @@ todo_wine
bret = pAcceptEx(listener, INVALID_SOCKET, buffer, sizeof(buffer) - 2*(sizeof(struct sockaddr_in) + 16),
sizeof(struct sockaddr_in) + 16, sizeof(struct sockaddr_in) + 16,
&bytesReturned, &overlapped);
todo_wine
ok(bret == FALSE && WSAGetLastError() == WSAENOTSOCK, "AcceptEx on invalid listening socket "
ok(bret == FALSE && WSAGetLastError() == WSAENOTSOCK, "AcceptEx on invalid accepting socket "
"returned %d + errno %d\n", bret, WSAGetLastError());
bret = pAcceptEx(listener, acceptor, NULL, sizeof(buffer) - 2*(sizeof(struct sockaddr_in) + 16),
......@@ -5949,7 +5948,6 @@ todo_wine
bret = pAcceptEx(listener, acceptor, buffer, 0, 0, sizeof(struct sockaddr_in) + 16,
&bytesReturned, &overlapped);
todo_wine
ok(bret == FALSE && (WSAGetLastError() == ERROR_IO_PENDING || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
"AcceptEx on too small local address size returned %d + errno %d\n",
bret, WSAGetLastError());
......@@ -5958,7 +5956,6 @@ todo_wine
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 15,
sizeof(struct sockaddr_in) + 16, &bytesReturned, &overlapped);
todo_wine
ok(bret == FALSE && WSAGetLastError() == ERROR_IO_PENDING, "AcceptEx on too small local address "
"size returned %d + errno %d\n",
bret, WSAGetLastError());
......@@ -5967,13 +5964,11 @@ todo_wine
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 16, 0,
&bytesReturned, &overlapped);
todo_wine
ok(bret == FALSE && (WSAGetLastError() == WSAEFAULT || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
"AcceptEx on too small remote address size returned %d + errno %d\n", bret, WSAGetLastError());
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 16,
sizeof(struct sockaddr_in) + 15, &bytesReturned, &overlapped);
todo_wine
ok(bret == FALSE && (WSAGetLastError() == ERROR_IO_PENDING || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
"AcceptEx on too small remote address size returned %d + errno %d\n", bret, WSAGetLastError());
bret = CancelIo((HANDLE) listener);
......
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