ws2_32: Fix some parameters checking in AcceptEx.
This commit is contained in:
parent
b3d07c7846
commit
3c64a7c4e2
|
@ -2386,10 +2386,9 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((local_addr_len < sizeof(struct sockaddr_in) + 16)
|
if (!rem_addr_len)
|
||||||
|| (rem_addr_len < sizeof(struct sockaddr_in) + 16))
|
|
||||||
{
|
{
|
||||||
SetLastError(WSAEINVAL);
|
SetLastError(WSAEFAULT);
|
||||||
return FALSE;
|
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 );
|
fd = get_sock_fd( acceptor, FILE_READ_DATA, NULL );
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
SetLastError(WSAEINVAL);
|
SetLastError(WSAENOTSOCK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
release_sock_fd( acceptor, fd );
|
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),
|
bret = pAcceptEx(listener, INVALID_SOCKET, buffer, sizeof(buffer) - 2*(sizeof(struct sockaddr_in) + 16),
|
||||||
sizeof(struct sockaddr_in) + 16, sizeof(struct sockaddr_in) + 16,
|
sizeof(struct sockaddr_in) + 16, sizeof(struct sockaddr_in) + 16,
|
||||||
&bytesReturned, &overlapped);
|
&bytesReturned, &overlapped);
|
||||||
todo_wine
|
ok(bret == FALSE && WSAGetLastError() == WSAENOTSOCK, "AcceptEx on invalid accepting socket "
|
||||||
ok(bret == FALSE && WSAGetLastError() == WSAENOTSOCK, "AcceptEx on invalid listening socket "
|
|
||||||
"returned %d + errno %d\n", bret, WSAGetLastError());
|
"returned %d + errno %d\n", bret, WSAGetLastError());
|
||||||
|
|
||||||
bret = pAcceptEx(listener, acceptor, NULL, sizeof(buffer) - 2*(sizeof(struct sockaddr_in) + 16),
|
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,
|
bret = pAcceptEx(listener, acceptor, buffer, 0, 0, sizeof(struct sockaddr_in) + 16,
|
||||||
&bytesReturned, &overlapped);
|
&bytesReturned, &overlapped);
|
||||||
todo_wine
|
|
||||||
ok(bret == FALSE && (WSAGetLastError() == ERROR_IO_PENDING || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
|
ok(bret == FALSE && (WSAGetLastError() == ERROR_IO_PENDING || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
|
||||||
"AcceptEx on too small local address size returned %d + errno %d\n",
|
"AcceptEx on too small local address size returned %d + errno %d\n",
|
||||||
bret, WSAGetLastError());
|
bret, WSAGetLastError());
|
||||||
|
@ -5958,7 +5956,6 @@ todo_wine
|
||||||
|
|
||||||
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 15,
|
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 15,
|
||||||
sizeof(struct sockaddr_in) + 16, &bytesReturned, &overlapped);
|
sizeof(struct sockaddr_in) + 16, &bytesReturned, &overlapped);
|
||||||
todo_wine
|
|
||||||
ok(bret == FALSE && WSAGetLastError() == ERROR_IO_PENDING, "AcceptEx on too small local address "
|
ok(bret == FALSE && WSAGetLastError() == ERROR_IO_PENDING, "AcceptEx on too small local address "
|
||||||
"size returned %d + errno %d\n",
|
"size returned %d + errno %d\n",
|
||||||
bret, WSAGetLastError());
|
bret, WSAGetLastError());
|
||||||
|
@ -5967,13 +5964,11 @@ todo_wine
|
||||||
|
|
||||||
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 16, 0,
|
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 16, 0,
|
||||||
&bytesReturned, &overlapped);
|
&bytesReturned, &overlapped);
|
||||||
todo_wine
|
|
||||||
ok(bret == FALSE && (WSAGetLastError() == WSAEFAULT || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
|
ok(bret == FALSE && (WSAGetLastError() == WSAEFAULT || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
|
||||||
"AcceptEx on too small remote address size returned %d + errno %d\n", bret, WSAGetLastError());
|
"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,
|
bret = pAcceptEx(listener, acceptor, buffer, 0, sizeof(struct sockaddr_in) + 16,
|
||||||
sizeof(struct sockaddr_in) + 15, &bytesReturned, &overlapped);
|
sizeof(struct sockaddr_in) + 15, &bytesReturned, &overlapped);
|
||||||
todo_wine
|
|
||||||
ok(bret == FALSE && (WSAGetLastError() == ERROR_IO_PENDING || broken(WSAGetLastError() == WSAEINVAL)) /* NT4 */,
|
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());
|
"AcceptEx on too small remote address size returned %d + errno %d\n", bret, WSAGetLastError());
|
||||||
bret = CancelIo((HANDLE) listener);
|
bret = CancelIo((HANDLE) listener);
|
||||||
|
|
Loading…
Reference in New Issue