This fixes stack overflows since edecac8afdd04701314381b6386e0f7ac862e066.
-- v3: win32u: Make sure that the stack buffer in set_multi_value_key is large enough
From: Martin Storsjö martin@martin.st
This fixes stack overflows since edecac8afdd04701314381b6386e0f7ac862e066.
Signed-off-by: Martin Storsjö martin@martin.st --- 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 9ead47e1983..cf7f2f2ea21 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -2919,12 +2919,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)
On Mon Oct 24 11:55:45 2022 +0000, Martin Storsjö wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/1147/diffs?diff_id=15206&start_sha=2bef5a2c1dcab4daebda5507caa13c9e61335009#5a89ffa87018ebd407cb0b64202a300fa91397f9_2925_2924)
Done
On Mon Oct 24 11:55:46 2022 +0000, Martin Storsjö wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/1147/diffs?diff_id=15206&start_sha=2bef5a2c1dcab4daebda5507caa13c9e61335009#5a89ffa87018ebd407cb0b64202a300fa91397f9_2933_2934)
Done
This merge request was approved by Huw Davies.