https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46394ab80db2aee79ef78735cf3634056a1babd3

commit 46394ab80db2aee79ef78735cf3634056a1babd3
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Thu Jun 17 15:42:07 2021 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Mon Jun 28 10:20:57 2021 +0200

    [RTL] In RtlReleasePrivilege, raise exception if restoring old privileges 
fails
    
    CORE-17637
---
 sdk/lib/rtl/priv.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sdk/lib/rtl/priv.c b/sdk/lib/rtl/priv.c
index 34b860f1975..164bd80f75f 100644
--- a/sdk/lib/rtl/priv.c
+++ b/sdk/lib/rtl/priv.c
@@ -387,9 +387,12 @@ RtlReleasePrivilege(IN PVOID ReturnedState)
     else
     {
         /* Otherwise, restore old state */
-        ZwAdjustPrivilegesToken(State->Token, FALSE,
-                                State->OldPrivileges, 0, NULL, NULL);
-
+        Status = ZwAdjustPrivilegesToken(State->Token, FALSE,
+                                         State->OldPrivileges, 0, NULL, NULL);
+        if (!NT_SUCCESS(Status))
+        {
+            RtlRaiseStatus(Status);
+        }
     }
 
     /* If we used a different buffer for old privileges, just free it */

Reply via email to