Zebediah Figura : ws2_32: Check if the socket is bound in ConnectEx() in the server.
Alexandre Julliard
julliard at winehq.org
Thu Jun 17 15:38:06 CDT 2021
Module: wine
Branch: master
Commit: 93d001fa813660cb162c276698a9f550d7d41b54
URL: https://source.winehq.org/git/wine.git/?a=commit;h=93d001fa813660cb162c276698a9f550d7d41b54
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Jun 16 23:33:11 2021 -0500
ws2_32: Check if the socket is bound in ConnectEx() in the server.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 12 ------------
server/sock.c | 6 ++++++
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 845a0e68986..1a484da1527 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -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 );
diff --git a/server/sock.c b/server/sock.c
index 88f6e4ac9fd..bb0d13d9e6c 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -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 );
More information about the wine-cvs
mailing list