From 140eede67d595e8df034a2265f3c2670b3d69422 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Thu, 29 Oct 2009 11:11:38 +0100 Subject: [PATCH] ws2_32: Avoid accessing uninitialized memory in GetAddrInfoW. Found by valgrind. --- dlls/ws2_32/socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 7cf4b967475..df9c37d5047 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); -- 2.11.4.GIT