Module: wine Branch: master Commit: c55f8f3518c1ed6759de9078831956898b007d08 URL: https://gitlab.winehq.org/wine/wine/-/commit/c55f8f3518c1ed6759de90788319568...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Wed Mar 8 20:31:29 2023 +0200
kernel32: Fix GetNumberFormatA when input length is 0.
Fixes a regression introduced by b6bf69ef804146f81b803719a72d8c6afde184ba.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/kernel32/locale.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 16aa0bdd2aa..3783cf6505f 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -430,8 +430,6 @@ int WINAPI GetNumberFormatA( LCID lcid, DWORD flags, const char *value, } MultiByteToWideChar( cp, 0, value, -1, input, ARRAY_SIZE(input) );
- if (len > (int)ARRAY_SIZE(output)) len = ARRAY_SIZE(output); - if (format) { NUMBERFMTW fmt; @@ -455,9 +453,9 @@ int WINAPI GetNumberFormatA( LCID lcid, DWORD flags, const char *value, fmt.NegativeOrder = format->NegativeOrder; fmt.lpDecimalSep = fmt_decimal; fmt.lpThousandSep = fmt_thousand; - ret = GetNumberFormatW( lcid, flags, input, &fmt, output, len ); + ret = GetNumberFormatW( lcid, flags, input, &fmt, output, ARRAY_SIZE(output) ); } - else ret = GetNumberFormatW( lcid, flags, input, NULL, output, len ); + else ret = GetNumberFormatW( lcid, flags, input, NULL, output, ARRAY_SIZE(output) );
if (ret) ret = WideCharToMultiByte( cp, 0, output, -1, buffer, len, 0, 0 ); return ret;