[1/4] ws2_32: Avoid accessing uninitialized memory in GetAddrInfoW.

Hans Leidekker hans at codeweavers.com
Thu Oct 29 05:11:38 CDT 2009


Found by valgrind.
---
 dlls/ws2_32/socket.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 7cf4b96..df9c37d 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3962,6 +3962,8 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hin
     char *nodenameA, *servnameA = NULL;
     struct WS_addrinfo *resA, *hintsA = NULL;
 
+    if (!nodename) return WSAHOST_NOT_FOUND;
+
     len = WideCharToMultiByte(CP_ACP, 0, nodename, -1, NULL, 0, NULL, NULL);
     if (!(nodenameA = HeapAlloc(GetProcessHeap(), 0, len))) return EAI_MEMORY;
     WideCharToMultiByte(CP_ACP, 0, nodename, -1, nodenameA, len, NULL, NULL);
-- 
1.6.3.3





More information about the wine-patches mailing list