Akihiro Sagawa : ws2_32: Disallow NULL in socket lookups.

Alexandre Julliard julliard at winehq.org
Tue Aug 24 15:56:11 CDT 2021


Module: wine
Branch: master
Commit: ee2e5c0242462b0a1538253cc69c6c3043027790
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ee2e5c0242462b0a1538253cc69c6c3043027790

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue Aug 24 21:50:39 2021 +0900

ws2_32: Disallow NULL in socket lookups.

NULL means an unused slot, not a valid socket.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/socket.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index f58f7cea5cc..bf87e7824e5 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -379,6 +379,8 @@ static BOOL socket_list_find( SOCKET socket )
 {
     unsigned int i;
 
+    if (!socket) return FALSE;
+
     EnterCriticalSection( &cs_socket_list );
     for (i = 0; i < socket_list_size; ++i)
     {
@@ -397,6 +399,8 @@ static BOOL socket_list_remove( SOCKET socket )
 {
     unsigned int i;
 
+    if (!socket) return FALSE;
+
     EnterCriticalSection(&cs_socket_list);
     for (i = 0; i < socket_list_size; ++i)
     {




More information about the wine-cvs mailing list