From 8fde48b5d733c516eee249dad4df44ccdea2d40f Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Mon, 25 May 2020 23:52:35 +0200 Subject: [PATCH] [CSRSRV] CsrGetProcessLuid(): Check 1st NtQueryInformationToken() result too (#2857) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detected by Cppcheck: redundantAssignment. Co-authored-by: Hermès BÉLUSCA - MAÏTO --- 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)))