Skip to content

Commit 6859348

Browse files
committed
[SVCHOST] Fix PSID initialization
CORE-17151
1 parent 37c6377 commit 6859348

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

base/services/svchost/globals.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ ScDomainIdToSid (
234234
NTSTATUS
235235
NTAPI
236236
ScAllocateAndInitializeSid (
237-
_Out_ PVOID *Sid,
237+
_Out_ PSID *Sid,
238238
_In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
239239
_In_ ULONG SubAuthorityCount
240240
)
@@ -274,13 +274,18 @@ ScCreateWellKnownSids (
274274
for (i = 0; i < RTL_NUMBER_OF(SidData); i++)
275275
{
276276
/* Convert our optimized structure into an actual SID */
277-
Status = ScAllocateAndInitializeSid(&SidData[i].Sid,
277+
Status = ScAllocateAndInitializeSid(SidData[i].Sid,
278278
&SidData[i].Authority,
279279
1);
280-
if (!NT_SUCCESS(Status)) break;
280+
281+
if (!NT_SUCCESS(Status))
282+
{
283+
DBG_ERR("ScAllocateAndInitializeSid failed for %u\n", i);
284+
break;
285+
}
281286

282287
/* Write the correct sub-authority */
283-
*RtlSubAuthoritySid(SidData[i].Sid, 0) = SidData[i].SubAuthority;
288+
*RtlSubAuthoritySid(*SidData[i].Sid, 0) = SidData[i].SubAuthority;
284289
}
285290

286291
/* Now loop the domain SIDs */
@@ -289,8 +294,12 @@ ScCreateWellKnownSids (
289294
/* Convert our optimized structure into an actual SID */
290295
Status = ScDomainIdToSid(BuiltinDomainSid,
291296
DomainSidData[i].SubAuthority,
292-
&DomainSidData[i].Sid);
293-
if (!NT_SUCCESS(Status)) break;
297+
DomainSidData[i].Sid);
298+
if (!NT_SUCCESS(Status))
299+
{
300+
DBG_ERR("ScDomainIdToSid failed for %u\n", i);
301+
break;
302+
}
294303
}
295304

296305
/* If we got to the end, return success */

base/services/svchost/svchost.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ typedef VOID
5252
//
5353
typedef struct _DOMAIN_SID_DATA
5454
{
55-
PSID Sid;
55+
PSID* Sid;
5656
DWORD SubAuthority;
5757
} DOMAIN_SID_DATA;
5858

@@ -61,7 +61,7 @@ typedef struct _DOMAIN_SID_DATA
6161
//
6262
typedef struct _SID_DATA
6363
{
64-
PSID Sid;
64+
PSID* Sid;
6565
SID_IDENTIFIER_AUTHORITY Authority;
6666
DWORD SubAuthority;
6767
} SID_DATA;

0 commit comments

Comments
 (0)