crt: Fix the size passed to _vsnwprintf in emu__vscwprintf
The parameter to _vsnwprintf is a number of wchar_t's, not a number
of bytes.
Reported-by: Julien Vary <julienvary@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/stdio/_vscwprintf.c b/mingw-w64-crt/stdio/_vscwprintf.c
index 635074b..eafd1f2 100644
--- a/mingw-w64-crt/stdio/_vscwprintf.c
+++ b/mingw-w64-crt/stdio/_vscwprintf.c
@@ -33,7 +33,7 @@
}
/* if the number of characters to write is greater than size, _vsnwprintf() returns -1 */
- while (size < SIZE_MAX/2 && (ret = _vsnwprintf(buffer, size, format, arglist)) < 0) {
+ while (size < SIZE_MAX/2 && (ret = _vsnwprintf(buffer, size / sizeof(wchar_t), format, arglist)) < 0) {
/* in this case try with larger buffer */
size *= 2;
new_buffer = realloc(buffer, size);