netapi32: Fix heap buffer overflows.
This commit is contained in:
parent
bbfee0061d
commit
d5f2172c09
|
@ -112,7 +112,7 @@ static BOOL NETAPI_IsCurrentUser(LPCWSTR username)
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
dwSize = LM20_UNLEN+1;
|
dwSize = LM20_UNLEN+1;
|
||||||
curr_user = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
curr_user = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
|
||||||
if(!curr_user)
|
if(!curr_user)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate memory for user name.\n");
|
ERR("Failed to allocate memory for user name.\n");
|
||||||
|
@ -431,7 +431,7 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
size = UNLEN + 1;
|
size = UNLEN + 1;
|
||||||
NetApiBufferAllocate(size, (LPVOID*)¤tuser);
|
NetApiBufferAllocate(size * sizeof(WCHAR), (LPVOID*)¤tuser);
|
||||||
GetUserNameW(currentuser, &size);
|
GetUserNameW(currentuser, &size);
|
||||||
|
|
||||||
if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
|
if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
|
||||||
|
@ -640,7 +640,7 @@ NetQueryDisplayInformation(
|
||||||
|
|
||||||
/* get data */
|
/* get data */
|
||||||
dwSize = UNLEN + 1;
|
dwSize = UNLEN + 1;
|
||||||
NetApiBufferAllocate(dwSize, (LPVOID *) &name);
|
NetApiBufferAllocate(dwSize * sizeof(WCHAR), (LPVOID *) &name);
|
||||||
if (!GetUserNameW(name, &dwSize))
|
if (!GetUserNameW(name, &dwSize))
|
||||||
{
|
{
|
||||||
NetApiBufferFree(name);
|
NetApiBufferFree(name);
|
||||||
|
|
Loading…
Reference in New Issue