From 359205bcccd8b89f8de5f8e13f69742eee94ce0f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 22 Aug 2025 16:48:06 +0200 Subject: [PATCH] [CRT] wctomb must return 0 if the destination pointer is NULL This fixes 3 test failures. --- sdk/lib/crt/string/wcs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/lib/crt/string/wcs.c b/sdk/lib/crt/string/wcs.c index e056bf593f6..f238a78616d 100644 --- a/sdk/lib/crt/string/wcs.c +++ b/sdk/lib/crt/string/wcs.c @@ -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;