[SVCHOST] Fix PSID initialization

CORE-17151
This commit is contained in:
Mark Jansen 2020-07-02 22:25:46 +02:00
parent 37c63770d7
commit 6859348aea
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
2 changed files with 17 additions and 8 deletions

View file

@ -234,7 +234,7 @@ ScDomainIdToSid (
NTSTATUS
NTAPI
ScAllocateAndInitializeSid (
_Out_ PVOID *Sid,
_Out_ PSID *Sid,
_In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
_In_ ULONG SubAuthorityCount
)
@ -274,13 +274,18 @@ ScCreateWellKnownSids (
for (i = 0; i < RTL_NUMBER_OF(SidData); i++)
{
/* Convert our optimized structure into an actual SID */
Status = ScAllocateAndInitializeSid(&SidData[i].Sid,
Status = ScAllocateAndInitializeSid(SidData[i].Sid,
&SidData[i].Authority,
1);
if (!NT_SUCCESS(Status)) break;
if (!NT_SUCCESS(Status))
{
DBG_ERR("ScAllocateAndInitializeSid failed for %u\n", i);
break;
}
/* Write the correct sub-authority */
*RtlSubAuthoritySid(SidData[i].Sid, 0) = SidData[i].SubAuthority;
*RtlSubAuthoritySid(*SidData[i].Sid, 0) = SidData[i].SubAuthority;
}
/* Now loop the domain SIDs */
@ -289,8 +294,12 @@ ScCreateWellKnownSids (
/* Convert our optimized structure into an actual SID */
Status = ScDomainIdToSid(BuiltinDomainSid,
DomainSidData[i].SubAuthority,
&DomainSidData[i].Sid);
if (!NT_SUCCESS(Status)) break;
DomainSidData[i].Sid);
if (!NT_SUCCESS(Status))
{
DBG_ERR("ScDomainIdToSid failed for %u\n", i);
break;
}
}
/* If we got to the end, return success */

View file

@ -52,7 +52,7 @@ typedef VOID
//
typedef struct _DOMAIN_SID_DATA
{
PSID Sid;
PSID* Sid;
DWORD SubAuthority;
} DOMAIN_SID_DATA;
@ -61,7 +61,7 @@ typedef struct _DOMAIN_SID_DATA
//
typedef struct _SID_DATA
{
PSID Sid;
PSID* Sid;
SID_IDENTIFIER_AUTHORITY Authority;
DWORD SubAuthority;
} SID_DATA;