Alexandre Julliard : ntdll: Fix uninitialized buffer in locale initialization.
Alexandre Julliard
julliard at winehq.org
Wed Jul 1 15:22:48 CDT 2020
Module: wine
Branch: master
Commit: 21f1fa82a8c7bd1b077f0289141972ed619c5a5f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=21f1fa82a8c7bd1b077f0289141972ed619c5a5f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 1 13:32:09 2020 +0200
ntdll: Fix uninitialized buffer in locale initialization.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49494
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/env.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index e285bbbef0..789a398405 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -836,6 +836,8 @@ static BOOL unix_to_win_locale( const char *unix_name, char *win_name )
if (!unix_name || !unix_name[0]) return FALSE;
}
+ if (strlen( unix_name ) >= LOCALE_NAME_MAX_LENGTH) return FALSE;
+ strcpy( buffer, unix_name );
if (!(p = strpbrk( buffer, sep )))
{
if (!strcmp( buffer, "POSIX" ) || !strcmp( buffer, "C" ))
@@ -1247,6 +1249,6 @@ USHORT * CDECL get_unix_codepage_data(void)
*/
void CDECL get_locales( WCHAR *sys, WCHAR *user )
{
- ntdll_umbstowcs( system_locale, ARRAY_SIZE(system_locale), sys, LOCALE_NAME_MAX_LENGTH * sizeof(WCHAR) );
- ntdll_umbstowcs( user_locale, ARRAY_SIZE(user_locale), user, LOCALE_NAME_MAX_LENGTH * sizeof(WCHAR) );
+ ntdll_umbstowcs( system_locale, strlen(system_locale) + 1, sys, LOCALE_NAME_MAX_LENGTH );
+ ntdll_umbstowcs( user_locale, strlen(user_locale) + 1, user, LOCALE_NAME_MAX_LENGTH );
}
More information about the wine-cvs
mailing list