[CRT] wctomb must return 0 if the destination pointer is NULL

This fixes 3 test failures.
This commit is contained in:
Eric Kohl
2025-08-22 16:48:06 +02:00
parent 330fda8b6d
commit 359205bccc

View File

@@ -246,6 +246,9 @@ INT CDECL wctomb( char *dst, wchar_t ch )
BOOL error;
INT size;
if (!dst)
return 0;
size = WideCharToMultiByte(get_locinfo()->lc_codepage, 0, &ch, 1, dst, dst ? 6 : 0, NULL, &error);
if(!size || error) {
*_errno() = EINVAL;