[NTOSKRNL]

- Fix returning uninitialized status (CID 15086)

svn path=/trunk/; revision=55130
This commit is contained in:
Rafal Harabien 2012-01-23 20:49:08 +00:00
parent 52654ceb2e
commit 2d3c112a48

View file

@ -266,7 +266,6 @@ SepCaptureSid(IN PSID InputSid,
{ {
ULONG SidSize = 0; ULONG SidSize = 0;
PISID NewSid, Sid = (PISID)InputSid; PISID NewSid, Sid = (PISID)InputSid;
NTSTATUS Status;
PAGED_CODE(); PAGED_CODE();
@ -274,14 +273,9 @@ SepCaptureSid(IN PSID InputSid,
{ {
_SEH2_TRY _SEH2_TRY
{ {
ProbeForRead(Sid, ProbeForRead(Sid, FIELD_OFFSET(SID, SubAuthority), sizeof(UCHAR));
FIELD_OFFSET(SID,
SubAuthority),
sizeof(UCHAR));
SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount); SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
ProbeForRead(Sid, ProbeForRead(Sid, SidSize, sizeof(UCHAR));
SidSize,
sizeof(UCHAR));
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{ {
@ -291,15 +285,13 @@ SepCaptureSid(IN PSID InputSid,
_SEH2_END; _SEH2_END;
/* allocate a SID and copy it */ /* allocate a SID and copy it */
NewSid = ExAllocatePool(PoolType, NewSid = ExAllocatePool(PoolType, SidSize);
SidSize); if (!NewSid)
if (NewSid != NULL) return STATUS_INSUFFICIENT_RESOURCES;
{
_SEH2_TRY _SEH2_TRY
{ {
RtlCopyMemory(NewSid, RtlCopyMemory(NewSid, Sid, SidSize);
Sid,
SidSize);
*CapturedSid = NewSid; *CapturedSid = NewSid;
} }
@ -311,38 +303,25 @@ SepCaptureSid(IN PSID InputSid,
} }
_SEH2_END; _SEH2_END;
} }
else
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}
}
else if (!CaptureIfKernel) else if (!CaptureIfKernel)
{ {
*CapturedSid = InputSid; *CapturedSid = InputSid;
return STATUS_SUCCESS;
} }
else else
{ {
SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount); SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
/* allocate a SID and copy it */ /* allocate a SID and copy it */
NewSid = ExAllocatePool(PoolType, NewSid = ExAllocatePool(PoolType, SidSize);
SidSize); if (NewSid == NULL)
if (NewSid != NULL) return STATUS_INSUFFICIENT_RESOURCES;
{
RtlCopyMemory(NewSid, RtlCopyMemory(NewSid, Sid, SidSize);
Sid,
SidSize);
*CapturedSid = NewSid; *CapturedSid = NewSid;
} }
else
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}
}
return Status; return STATUS_SUCCESS;
} }
VOID VOID