Alexandre Julliard : winemac.drv: Fix RegQueryValueExW size handling.
Alexandre Julliard
julliard at winehq.org
Mon Nov 29 16:26:53 CST 2021
Module: wine
Branch: master
Commit: 60bece33a4bb1b9704e8e78b48aa6ee701effc92
URL: https://source.winehq.org/git/wine.git/?a=commit;h=60bece33a4bb1b9704e8e78b48aa6ee701effc92
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 29 21:17:41 2021 +0100
winemac.drv: Fix RegQueryValueExW size handling.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/display.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index 99c852d7ffe..fe48437849d 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -461,12 +461,11 @@ static struct display_mode_descriptor* create_original_display_mode_descriptor(C
size = 0;
if (RegQueryValueExW(hkey, pixelencodingW, 0, &type, NULL, &size) || type != REG_SZ)
goto done;
- pixel_encoding = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
+ size += sizeof(WCHAR);
+ pixel_encoding = HeapAlloc(GetProcessHeap(), 0, size);
if (RegQueryValueExW(hkey, pixelencodingW, 0, &type, (BYTE*)pixel_encoding, &size) || type != REG_SZ)
goto done;
- if ((end = memchrW(pixel_encoding, 0, size)))
- size = end - pixel_encoding;
- desc->pixel_encoding = CFStringCreateWithCharacters(NULL, (const UniChar*)pixel_encoding, size);
+ desc->pixel_encoding = CFStringCreateWithCharacters(NULL, (const UniChar*)pixel_encoding, strlenW(pixel_encoding));
ret = desc;
More information about the wine-cvs
mailing list