https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8fde48b5d733c516eee249dad4df44ccdea2d40f

commit 8fde48b5d733c516eee249dad4df44ccdea2d40f
Author:     Serge Gautherie <[email protected]>
AuthorDate: Mon May 25 23:52:35 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Mon May 25 23:52:35 2020 +0200

    [CSRSRV] CsrGetProcessLuid(): Check 1st NtQueryInformationToken() result 
too (#2857)
    
    Detected by Cppcheck: redundantAssignment.
    Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
---
 subsystems/win32/csrsrv/procsup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/subsystems/win32/csrsrv/procsup.c 
b/subsystems/win32/csrsrv/procsup.c
index 30cde8a2fea..de9743cd6c2 100644
--- a/subsystems/win32/csrsrv/procsup.c
+++ b/subsystems/win32/csrsrv/procsup.c
@@ -873,6 +873,12 @@ CsrGetProcessLuid(IN HANDLE hProcess OPTIONAL,
                                      NULL,
                                      0,
                                      &Length);
+    if (Status != STATUS_BUFFER_TOO_SMALL)
+    {
+        /* Close the token and fail */
+        NtClose(hToken);
+        return Status;
+    }
 
     /* Allocate memory for the Token Info */
     if (!(TokenStats = RtlAllocateHeap(CsrHeap, 0, Length)))

Reply via email to