Fix possible CloseHandle on bad token in the Default Folder ACLs patch.

This commit is contained in:
Erich E. Hoover 2014-10-09 12:43:38 -06:00
parent 18657270f8
commit 9e2db30661

View File

@ -1,4 +1,4 @@
From 2da338393244264d5a5e872b0dd0198cd32e501c Mon Sep 17 00:00:00 2001
From 5acc23c9ced211c685c64716f20eecbdb8f2aa27 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 25 Feb 2014 10:44:36 -0700
Subject: shell32: Set the default security attributes for user shell folders.
@ -8,7 +8,7 @@ Subject: shell32: Set the default security attributes for user shell folders.
1 file changed, 100 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index f92d56e..ef83065 100644
index f92d56e..0ca7211 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -2200,6 +2200,85 @@ cleanup:
@ -33,8 +33,8 @@ index f92d56e..ef83065 100644
+
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &token))
+ {
+ if (GetLastError() != ERROR_NO_TOKEN) goto cleanup;
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token)) goto cleanup;
+ if (GetLastError() != ERROR_NO_TOKEN) return NULL;
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token)) return NULL;
+ }
+ GetTokenInformation(token, TokenUser, NULL, 0, &user_size);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto cleanup;