[ADVAPI32] Avoid excessive allocation in CheckTokenMembership. CORE-16094

This commit is contained in:
Michael Maltsev 2019-06-03 12:35:58 +03:00 committed by Thomas Faber
parent 17bc3d69f9
commit a303932803
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -100,7 +100,7 @@ CheckTokenMembership(IN HANDLE ExistingTokenHandle,
0,
sizeof(SECURITY_DESCRIPTOR) +
sizeof(ACL) + SidLen +
sizeof(ACCESS_ALLOWED_ACE));
FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart));
if (SecurityDescriptor == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@ -134,7 +134,7 @@ CheckTokenMembership(IN HANDLE ExistingTokenHandle,
/* create the DACL */
Dacl = (PACL)(SecurityDescriptor + 1);
Status = RtlCreateAcl(Dacl,
sizeof(ACL) + SidLen + sizeof(ACCESS_ALLOWED_ACE),
sizeof(ACL) + SidLen + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart),
ACL_REVISION);
if (!NT_SUCCESS(Status))
{