Torge Matthies : win32u: Calculate buffer sizes from registry structs correctly.

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:48 CDT 2022


Module: wine
Branch: master
Commit: 32d557142cc6a0f4140911561d4e553f3891243f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=32d557142cc6a0f4140911561d4e553f3891243f

Author: Torge Matthies <tmatthies at codeweavers.com>
Date:   Sun May  1 02:03:20 2022 +0200

win32u: Calculate buffer sizes from registry structs correctly.

Signed-off-by: Torge Matthies <tmatthies at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/win32u/sysparams.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 8a99e4095f9..136f47672d0 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -1258,7 +1258,8 @@ static BOOL update_display_cache_from_registry(void)
                                                   sizeof(devicemap_video_keyW) )))
         return FALSE;
 
-    status = NtQueryKey( video_key, KeyFullInformation, &key, sizeof(key), &size );
+    status = NtQueryKey( video_key, KeyFullInformation, &key,
+                         offsetof(KEY_FULL_INFORMATION, Class), &size );
     if (status && status != STATUS_BUFFER_OVERFLOW)
         return FALSE;
 
@@ -3210,7 +3211,7 @@ void sysparams_init(void)
 
         if ((hkey = reg_open_key( config_key, software_fontsW, sizeof(software_fontsW) )))
         {
-            char buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD)];
+            char buffer[offsetof(KEY_VALUE_PARTIAL_INFORMATION, Data[sizeof(DWORD)])];
             KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer;
 
             if (query_reg_value( hkey, log_pixelsW, value, sizeof(buffer) ) && value->Type == REG_DWORD)




More information about the wine-cvs mailing list