Commit f014487f authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

netapi32: Check for GetUserNameW return (Coverity).

parent 354d4168
...@@ -437,7 +437,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level, ...@@ -437,7 +437,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
size = UNLEN + 1; size = UNLEN + 1;
NetApiBufferAllocate(size * sizeof(WCHAR), (LPVOID*)&currentuser); 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)) if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
{ {
......
...@@ -196,7 +196,9 @@ NET_API_STATUS WINAPI NetLocalGroupGetMembers( ...@@ -196,7 +196,9 @@ NET_API_STATUS WINAPI NetLocalGroupGetMembers(
*entriesread = 0; *entriesread = 0;
userNameLen = MAX_COMPUTERNAME_LENGTH + 1; userNameLen = MAX_COMPUTERNAME_LENGTH + 1;
GetUserNameW(userName,&userNameLen); if (!GetUserNameW(userName,&userNameLen))
return ERROR_NOT_ENOUGH_MEMORY;
needlen = sizeof(LOCALGROUP_MEMBERS_INFO_3) + needlen = sizeof(LOCALGROUP_MEMBERS_INFO_3) +
(userNameLen+2) * sizeof(WCHAR); (userNameLen+2) * sizeof(WCHAR);
if (prefmaxlen != MAX_PREFERRED_LENGTH) if (prefmaxlen != MAX_PREFERRED_LENGTH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment