netapi32: Check for GetUserNameW return (Coverity).
This commit is contained in:
parent
354d41685f
commit
f014487f9e
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue