[PATCH 5/5] ws2_32: Always return WSAEINVAL if AF_UNSPEC is used with a zero protocol.

Zebediah Figura z.figura12 at gmail.com
Thu Sep 24 22:21:04 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ws2_32/socket.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 1ac1f77d6e6..5089029f4b4 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -7648,7 +7648,13 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
             protocol = lpProtocolInfo->iProtocol;
     }
 
-    if (!type && (af || protocol))
+    if (!af && !protocol)
+    {
+        WSASetLastError(WSAEINVAL);
+        return INVALID_SOCKET;
+    }
+
+    if (!type)
     {
         int autoproto = protocol;
         WSAPROTOCOL_INFOW infow;
-- 
2.28.0




More information about the wine-devel mailing list