[WIN32K:NTUSER] Fix an unintialized user's token variable case

And remove the "!NT_SUCCESS(Status)" check which is excessive, the expected
status will always be STATUS_BUFFER_TOO_SMALL anyway. This should fix
some compilation warnings spotted by GCC. Courtesy goes to Hermes for letting
me know of these warnings.
This commit is contained in:
George Bișoc 2023-06-11 00:00:03 +02:00
parent 7d5e159131
commit 0f9be53985
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6

View file

@ -2,7 +2,7 @@
* PROJECT: ReactOS Win32k subsystem * PROJECT: ReactOS Win32k subsystem
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Security infrastructure of NTUSER component of Win32k * PURPOSE: Security infrastructure of NTUSER component of Win32k
* COPYRIGHT: Copyright 2022 George Bișoc <george.bisoc@reactos.org> * COPYRIGHT: Copyright 2022-2023 George Bișoc <george.bisoc@reactos.org>
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
@ -170,7 +170,7 @@ IntQueryUserSecurityIdentification(
_Out_ PTOKEN_USER *User) _Out_ PTOKEN_USER *User)
{ {
NTSTATUS Status; NTSTATUS Status;
PTOKEN_USER UserToken; PTOKEN_USER UserToken = NULL;
HANDLE Token; HANDLE Token;
ULONG BufferLength; ULONG BufferLength;
@ -196,7 +196,7 @@ IntQueryUserSecurityIdentification(
NULL, NULL,
0, 0,
&BufferLength); &BufferLength);
if (!NT_SUCCESS(Status) && Status == STATUS_BUFFER_TOO_SMALL) if (Status == STATUS_BUFFER_TOO_SMALL)
{ {
/* /*
* Allocate some memory for the buffer * Allocate some memory for the buffer
@ -212,6 +212,12 @@ IntQueryUserSecurityIdentification(
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }
} }
else if (!NT_SUCCESS(Status))
{
ERR("IntQueryUserSecurityIdentification(): Failed to query the necessary length for the buffer (Status 0x%08lx)!\n", Status);
ZwClose(Token);
return Status;
}
/* Query the user now as we have plenty of space to hold it */ /* Query the user now as we have plenty of space to hold it */
Status = ZwQueryInformationToken(Token, Status = ZwQueryInformationToken(Token,