kernelbase: Fix copy size for delete_privs in CreateRestrictedToken().

Fixes 3D Aim Trainer crash on start.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit d63e0b7084)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Paul Gofman 2021-08-04 13:43:46 +03:00 committed by Michael Stefaniuc
parent 83923e43d5
commit f9f4e8f692
1 changed files with 3 additions and 3 deletions

View File

@ -662,21 +662,21 @@ BOOL WINAPI CreateRestrictedToken( HANDLE token, DWORD flags,
{
if (!(nt_disable_sids = heap_alloc( offsetof( TOKEN_GROUPS, Groups[disable_sid_count] ) ))) goto out;
nt_disable_sids->GroupCount = disable_sid_count;
memcpy( nt_disable_sids->Groups, disable_sids, disable_sid_count * sizeof(SID_AND_ATTRIBUTES) );
memcpy( nt_disable_sids->Groups, disable_sids, disable_sid_count * sizeof(*disable_sids) );
}
if (delete_priv_count)
{
if (!(nt_privs = heap_alloc( offsetof( TOKEN_GROUPS, Groups[delete_priv_count] ) ))) goto out;
nt_privs->PrivilegeCount = delete_priv_count;
memcpy( nt_privs->Privileges, delete_privs, delete_priv_count * sizeof(SID_AND_ATTRIBUTES) );
memcpy( nt_privs->Privileges, delete_privs, delete_priv_count * sizeof(*delete_privs) );
}
if (restrict_sid_count)
{
if (!(nt_restrict_sids = heap_alloc( offsetof( TOKEN_GROUPS, Groups[restrict_sid_count] ) ))) goto out;
nt_restrict_sids->GroupCount = restrict_sid_count;
memcpy( nt_restrict_sids->Groups, restrict_sids, restrict_sid_count * sizeof(SID_AND_ATTRIBUTES) );
memcpy( nt_restrict_sids->Groups, restrict_sids, restrict_sid_count * sizeof(*restrict_sids) );
}
status = NtFilterToken(token, flags, nt_disable_sids, nt_privs, nt_restrict_sids, ret);