In the inline form of _snwprintf, we set
_CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION,
but in the non-inline version, we just called
vsnwprintf, which doesn't set that option.

Instead call __stdio_common_vswprintf directly, with the right
options.

The previous form stemmed from the original UCRT implementation
in bc6a87488995675ae80c312e3585cb1ace739b43.

Signed-off-by: Martin Storsjö <mar...@martin.st>
---
 mingw-w64-crt/stdio/ucrt__snwprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/stdio/ucrt__snwprintf.c 
b/mingw-w64-crt/stdio/ucrt__snwprintf.c
index d4d5eff17..07cdf18a4 100644
--- a/mingw-w64-crt/stdio/ucrt__snwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__snwprintf.c
@@ -30,7 +30,7 @@ int __cdecl _snwprintf(wchar_t * restrict _Dest, size_t 
_Count, const wchar_t *
   va_list ap;
   int ret;
   va_start(ap, _Format);
-  ret = vsnwprintf(_Dest, _Count, _Format, ap);
+  ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | 
_CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, 
NULL, ap);
   va_end(ap);
   return ret;
 }
-- 
2.34.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to