mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[CSRSRV] CsrSetProcessSecurity(): Check 1st NtQueryInformationToken() result (#2862)
Also: * Add 1 NtClose(hToken), in an error case. * Do not call RtlFreeHeap(..., ..., NULL). Follow-up to #2857.
This commit is contained in:
parent
64fea1dbd0
commit
4425bd8db3
1 changed files with 8 additions and 2 deletions
|
@ -74,12 +74,18 @@ CsrSetProcessSecurity(VOID)
|
|||
if (!NT_SUCCESS(Status)) goto Quickie;
|
||||
|
||||
/* Get the Token User Length */
|
||||
NtQueryInformationToken(hToken, TokenUser, NULL, 0, &Length);
|
||||
Status = NtQueryInformationToken(hToken, TokenUser, NULL, 0, &Length);
|
||||
if (Status != STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
NtClose(hToken);
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Allocate space for it */
|
||||
TokenInfo = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Length);
|
||||
if (!TokenInfo)
|
||||
{
|
||||
NtClose(hToken);
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
@ -153,7 +159,7 @@ CsrSetProcessSecurity(VOID)
|
|||
/* Free the memory and return */
|
||||
Quickie:
|
||||
if (ProcSd) RtlFreeHeap(CsrHeap, 0, ProcSd);
|
||||
RtlFreeHeap(CsrHeap, 0, TokenInfo);
|
||||
if (TokenInfo) RtlFreeHeap(CsrHeap, 0, TokenInfo);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue