[PATCH] kernelbase: Fix an incorrect allocation size.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Aug 10 09:40:12 CDT 2021


Variable nt_privs has type TOKEN_PRIVILEGES*, not TOKEN_GROUPS*.

This fixes a crash in the Cyberpunk 2077 launcher.

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 dlls/kernelbase/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/kernelbase/security.c b/dlls/kernelbase/security.c
index 36196304db3..472076cf7fe 100644
--- a/dlls/kernelbase/security.c
+++ b/dlls/kernelbase/security.c
@@ -667,7 +667,7 @@ BOOL WINAPI CreateRestrictedToken( HANDLE token, DWORD flags,
 
     if (delete_priv_count)
     {
-        if (!(nt_privs = heap_alloc( offsetof( TOKEN_GROUPS, Groups[delete_priv_count] ) ))) goto out;
+        if (!(nt_privs = heap_alloc( offsetof( TOKEN_PRIVILEGES, Privileges[delete_priv_count] ) ))) goto out;
         nt_privs->PrivilegeCount = delete_priv_count;
         memcpy( nt_privs->Privileges, delete_privs, delete_priv_count * sizeof(*delete_privs) );
     }
-- 
2.32.0




More information about the wine-devel mailing list