ws2_32: Fix some parameters checking in AcceptEx.

This commit is contained in:
Bruno Jesus 2014-02-05 22:38:54 -02:00 committed by Alexandre Julliard
parent b3d07c7846
commit 3c64a7c4e2
2 changed files with 4 additions and 10 deletions

View File

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

View File

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