Author: rharabien
Date: Mon Jan 23 20:49:08 2012
New Revision: 55130
URL:
http://svn.reactos.org/svn/reactos?rev=55130&view=rev
Log:
[NTOSKRNL]
- Fix returning uninitialized status (CID 15086)
Modified:
trunk/reactos/ntoskrnl/se/sid.c
Modified: trunk/reactos/ntoskrnl/se/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=5513…
==============================================================================
--- trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] Mon Jan 23 20:49:08 2012
@@ -266,7 +266,6 @@
{
ULONG SidSize = 0;
PISID NewSid, Sid = (PISID)InputSid;
- NTSTATUS Status;
PAGED_CODE();
@@ -274,14 +273,9 @@
{
_SEH2_TRY
{
- ProbeForRead(Sid,
- FIELD_OFFSET(SID,
- SubAuthority),
- sizeof(UCHAR));
+ ProbeForRead(Sid, FIELD_OFFSET(SID, SubAuthority), sizeof(UCHAR));
SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
- ProbeForRead(Sid,
- SidSize,
- sizeof(UCHAR));
+ ProbeForRead(Sid, SidSize, sizeof(UCHAR));
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@@ -291,58 +285,43 @@
_SEH2_END;
/* allocate a SID and copy it */
- NewSid = ExAllocatePool(PoolType,
- SidSize);
- if (NewSid != NULL)
+ NewSid = ExAllocatePool(PoolType, SidSize);
+ if (!NewSid)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ _SEH2_TRY
{
- _SEH2_TRY
- {
- RtlCopyMemory(NewSid,
- Sid,
- SidSize);
-
- *CapturedSid = NewSid;
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- /* Free the SID and return the exception code */
- ExFreePoolWithTag(NewSid, TAG_SID);
- _SEH2_YIELD(return _SEH2_GetExceptionCode());
- }
- _SEH2_END;
- }
- else
- {
- Status = STATUS_INSUFFICIENT_RESOURCES;
- }
- }
- else if (!CaptureIfKernel)
- {
- *CapturedSid = InputSid;
- return STATUS_SUCCESS;
- }
- else
- {
- SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
-
- /* allocate a SID and copy it */
- NewSid = ExAllocatePool(PoolType,
- SidSize);
- if (NewSid != NULL)
- {
- RtlCopyMemory(NewSid,
- Sid,
- SidSize);
+ RtlCopyMemory(NewSid, Sid, SidSize);
*CapturedSid = NewSid;
}
- else
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = STATUS_INSUFFICIENT_RESOURCES;
+ /* Free the SID and return the exception code */
+ ExFreePoolWithTag(NewSid, TAG_SID);
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
- }
-
- return Status;
+ _SEH2_END;
+ }
+ else if (!CaptureIfKernel)
+ {
+ *CapturedSid = InputSid;
+ }
+ else
+ {
+ SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
+
+ /* allocate a SID and copy it */
+ NewSid = ExAllocatePool(PoolType, SidSize);
+ if (NewSid == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ RtlCopyMemory(NewSid, Sid, SidSize);
+
+ *CapturedSid = NewSid;
+ }
+
+ return STATUS_SUCCESS;
}
VOID