[PATCH] netapi32: Check for GetUserNameW return (Coverity)

Marcus Meissner meissner at suse.de
Wed Sep 7 08:18:58 CDT 2011


Only thing that can happen is out of memory currently.
CID 5136

Ciao, Marcus
---
 dlls/netapi32/local_group.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/netapi32/local_group.c b/dlls/netapi32/local_group.c
index 7f7d3c1..f4f4214 100644
--- a/dlls/netapi32/local_group.c
+++ b/dlls/netapi32/local_group.c
@@ -196,7 +196,9 @@ NET_API_STATUS WINAPI NetLocalGroupGetMembers(
         *entriesread = 0;
 
         userNameLen = MAX_COMPUTERNAME_LENGTH + 1;
-        GetUserNameW(userName,&userNameLen);
+        if (!GetUserNameW(userName,&userNameLen))
+            return ERROR_NOT_ENOUGH_MEMORY;
+
         needlen = sizeof(LOCALGROUP_MEMBERS_INFO_3) +
              (userNameLen+2) * sizeof(WCHAR);
         if (prefmaxlen != MAX_PREFERRED_LENGTH)
-- 
1.7.1




More information about the wine-patches mailing list