[MSVCRT] Fix a bug in _wctomb_l

Fixes crash in msvcrt_apitest:wctomb
This commit is contained in:
Timo Kreuzer
2025-12-30 12:57:14 +02:00
parent 86c6a4ebd7
commit d2336bead5
+10 -1
View File
@@ -2147,8 +2147,17 @@ int CDECL wctomb_s(int *len, char *mbchar, size_t size, wchar_t wch)
int CDECL _wctomb_l(char *dst, wchar_t ch, _locale_t locale)
{
int len;
#ifdef __REACTOS__
int maxlen;
if (locale)
maxlen = locale->locinfo->mb_cur_max;
else
maxlen = get_locinfo()->mb_cur_max;
if (_wctomb_s_l(&len, dst, maxlen, ch, locale) != 0)
return -1;
#else
_wctomb_s_l(&len, dst, dst ? MB_LEN_MAX : 0, ch, locale);
#endif
return len;
}