[REACTOS] Fix GetTokenInformation() usage (#2997)

The first call to GetTokenInformation is used to determine the size of a TokenInformation buffer.
It should fail and return ERROR_INSUFFICIENT_BUFFER
This commit is contained in:
Serge Gautherie 2020-07-21 14:39:11 +02:00 committed by GitHub
parent b338fb7beb
commit 98bbe8358c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View file

@ -65,7 +65,7 @@ RunningAsSYSTEM(VOID)
return FALSE;
/* Retrieve token's information */
if (!GetTokenInformation(hToken, TokenUser, NULL, 0, &cbTokenBuffer) &&
if (GetTokenInformation(hToken, TokenUser, NULL, 0, &cbTokenBuffer) ||
GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
goto Quit;