ws2_32: Check if the socket is bound in ConnectEx() in the server.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-06-16 23:33:11 -05:00 committed by Alexandre Julliard
parent 5295cc273e
commit 93d001fa81
2 changed files with 6 additions and 12 deletions

View File

@ -2014,22 +2014,10 @@ static BOOL WINAPI WS2_ConnectEx( SOCKET s, const struct WS_sockaddr *name, int
struct afd_connect_params *params;
void *cvalue = NULL;
NTSTATUS status;
int fd, ret;
TRACE( "socket %#lx, ptr %p %s, length %d, send_buffer %p, send_len %u, overlapped %p\n",
s, name, debugstr_sockaddr(name), namelen, send_buffer, send_len, overlapped );
if ((fd = get_sock_fd( s, FILE_READ_DATA, NULL )) == -1)
return FALSE;
if ((ret = is_fd_bound( fd, NULL, NULL )) <= 0)
{
SetLastError( ret ? wsaErrno() : WSAEINVAL );
release_sock_fd( s, fd );
return FALSE;
}
release_sock_fd( s, fd );
if (!overlapped)
{
SetLastError( WSA_INVALID_PARAMETER );

View File

@ -2126,6 +2126,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
send_len = get_req_data_size() - sizeof(*params) - params->addr_len;
addr = (const struct WS_sockaddr *)(params + 1);
if (!params->synchronous && !sock->bound)
{
set_error( STATUS_INVALID_PARAMETER );
return 0;
}
if (sock->accept_recv_req)
{
set_error( STATUS_INVALID_PARAMETER );