ntdll: Do not touch the privilege output buffers if access_check fails.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-02-07 19:50:10 -06:00 committed by Alexandre Julliard
parent bdc10c65ca
commit d14cf677b5
2 changed files with 4 additions and 4 deletions

View File

@ -1344,7 +1344,7 @@ static void test_AccessCheck(void)
"NtAccessCheck shouldn't set last error, got %d\n", err);
ok(Access == 0x1abe11ed && ntAccessStatus == 0x1abe11ed,
"Access and/or AccessStatus were changed!\n");
todo_wine ok(ntPrivSetLen == 0, "PrivSetLen returns %d\n", ntPrivSetLen);
ok(ntPrivSetLen == 0, "PrivSetLen returns %d\n", ntPrivSetLen);
/* Generic access mask - insufficient returnlength */
SetLastError(0xdeadbeef);
@ -1359,7 +1359,7 @@ static void test_AccessCheck(void)
"NtAccessCheck shouldn't set last error, got %d\n", err);
ok(Access == 0x1abe11ed && ntAccessStatus == 0x1abe11ed,
"Access and/or AccessStatus were changed!\n");
todo_wine ok(ntPrivSetLen == sizeof(PRIVILEGE_SET)-1, "PrivSetLen returns %d\n", ntPrivSetLen);
ok(ntPrivSetLen == sizeof(PRIVILEGE_SET)-1, "PrivSetLen returns %d\n", ntPrivSetLen);
/* Key access mask - zero returnlength */
SetLastError(0xdeadbeef);

View File

@ -732,10 +732,10 @@ NTSTATUS WINAPI NtAccessCheck( PSECURITY_DESCRIPTOR descr, HANDLE token, ACCESS_
status = wine_server_call( req );
*retlen = max( offsetof( PRIVILEGE_SET, Privilege ) + reply->privileges_len, sizeof(PRIVILEGE_SET) );
privs->PrivilegeCount = reply->privileges_len / sizeof(LUID_AND_ATTRIBUTES);
if (status == STATUS_SUCCESS)
{
*retlen = max( offsetof( PRIVILEGE_SET, Privilege ) + reply->privileges_len, sizeof(PRIVILEGE_SET) );
privs->PrivilegeCount = reply->privileges_len / sizeof(LUID_AND_ATTRIBUTES);
*access_status = reply->access_status;
*access_granted = reply->access_granted;
}