diff --git a/dlls/netapi32/access.c b/dlls/netapi32/access.c index 255e51b315..7cd05fcbbe 100644 --- a/dlls/netapi32/access.c +++ b/dlls/netapi32/access.c @@ -437,7 +437,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level, size = UNLEN + 1; NetApiBufferAllocate(size * sizeof(WCHAR), (LPVOID*)¤tuser); - GetUserNameW(currentuser, &size); + if (!GetUserNameW(currentuser, &size)) { + NetApiBufferFree(currentuser); + return ERROR_NOT_ENOUGH_MEMORY; + } if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username)) { diff --git a/dlls/netapi32/local_group.c b/dlls/netapi32/local_group.c index 7f7d3c1900..f4f42141e7 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)