[PATCH] ws2_32: Always return WSAEINVAL from GetAddrInfoExOverlappedResult if overlapped is NULL.

Connor McAdams cmcadams at codeweavers.com
Wed Dec 15 12:30:03 CST 2021


Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
 dlls/ws2_32/protocol.c       | 4 ++++
 dlls/ws2_32/tests/protocol.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c
index 239e4d14cd2..867e9513ca2 100644
--- a/dlls/ws2_32/protocol.c
+++ b/dlls/ws2_32/protocol.c
@@ -514,6 +514,10 @@ int WINAPI GetAddrInfoExW( const WCHAR *name, const WCHAR *servname, DWORD names
 int WINAPI GetAddrInfoExOverlappedResult( OVERLAPPED *overlapped )
 {
     TRACE( "(%p)\n", overlapped );
+
+    if (!overlapped)
+        return WSAEINVAL;
+
     return overlapped->Internal;
 }
 
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c
index 6eebb5f6b4d..881e3a388fd 100644
--- a/dlls/ws2_32/tests/protocol.c
+++ b/dlls/ws2_32/tests/protocol.c
@@ -1904,6 +1904,9 @@ static void test_GetAddrInfoExW(void)
     ok(!ret, "GetAddrInfoExW failed with %d\n", WSAGetLastError());
     pFreeAddrInfoExW(result);
 
+    ret = pGetAddrInfoExOverlappedResult(NULL);
+    ok(ret == WSAEINVAL, "overlapped result is %d\n", ret);
+
     result = (void *)0xdeadbeef;
     memset(&overlapped, 0xcc, sizeof(overlapped));
     overlapped.hEvent = event;
-- 
2.25.1




More information about the wine-devel mailing list