From 32d557142cc6a0f4140911561d4e553f3891243f Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Sun, 1 May 2022 02:03:20 +0200 Subject: [PATCH] win32u: Calculate buffer sizes from registry structs correctly. Signed-off-by: Torge Matthies Signed-off-by: Alexandre Julliard --- 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)