[PATCH 0/1] MR7957: gdi32: Fix termination in destination string in logfont_AtoW.
Followup of 1d3bfdc3ab. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7957
From: Bernhard Übelacker <bernhardu(a)mailbox.org> Followup of 1d3bfdc3ab. --- dlls/gdi32/text.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 7725e832c6b..438e378506d 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -780,10 +780,11 @@ static void text_metric_ex_WtoA(const NEWTEXTMETRICEXW *tmW, NEWTEXTMETRICEXA *t static void logfont_AtoW( const LOGFONTA *fontA, LPLOGFONTW fontW ) { + size_t len = strnlen( fontA->lfFaceName, LF_FACESIZE ); memcpy( fontW, fontA, sizeof(LOGFONTA) - LF_FACESIZE ); - MultiByteToWideChar( CP_ACP, 0, fontA->lfFaceName, strnlen( fontA->lfFaceName, LF_FACESIZE ), + MultiByteToWideChar( CP_ACP, 0, fontA->lfFaceName, len, fontW->lfFaceName, LF_FACESIZE ); - fontW->lfFaceName[LF_FACESIZE - 1] = 0; + if (len < LF_FACESIZE) fontW->lfFaceName[len] = 0; } static void logfont_WtoA( const LOGFONTW *fontW, LPLOGFONTA fontA ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7957
Sorry, did not notice !7956, which got submitted just a few minutes before this one. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7957#note_102389
This merge request was closed by Bernhard Übelacker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7957
participants (1)
-
Bernhard Übelacker