netapi32: Check for GetUserNameW return (Coverity).

This commit is contained in:
Marcus Meissner 2011-09-07 15:18:58 +02:00 committed by Alexandre Julliard
parent 354d41685f
commit f014487f9e
2 changed files with 7 additions and 2 deletions

View File

@ -437,7 +437,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
size = UNLEN + 1;
NetApiBufferAllocate(size * sizeof(WCHAR), (LPVOID*)&currentuser);
GetUserNameW(currentuser, &size);
if (!GetUserNameW(currentuser, &size)) {
NetApiBufferFree(currentuser);
return ERROR_NOT_ENOUGH_MEMORY;
}
if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
{

View File

@ -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)