From 0cb279812546bedae68bc86210facd6c00dbb83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 24 Oct 2022 10:49:52 +0300 Subject: [PATCH] win32u: Make sure that the stack buffer in set_multi_value_key is large enough. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes stack overflows since edecac8afdd04701314381b6386e0f7ac862e066. Signed-off-by: Martin Storsjö --- dlls/win32u/font.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 6746f7fcb40..75189f8ec5a 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -3043,12 +3043,19 @@ static void update_font_association_info(void) static void set_multi_value_key( HKEY hkey, const WCHAR *name, const char *value, DWORD len ) { - WCHAR valueW[256]; + WCHAR *valueW; + + if (!(valueW = malloc( len * sizeof(WCHAR) ))) + { + ERR( "malloc of %d * WCHAR failed\n", len ); + return; + } ascii_to_unicode( valueW, value, len ); if (value) set_reg_value( hkey, name, REG_MULTI_SZ, valueW, len * sizeof(WCHAR) ); else if (name) reg_delete_value( hkey, name ); + free( valueW ); } static void update_font_system_link_info(void)