Module: wine Branch: master Commit: 9571b362418e4491916ac79b430e5bee4b9a0aa4 URL: https://source.winehq.org/git/wine.git/?a=commit;h=9571b362418e4491916ac79b4...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Dec 4 15:30:13 2019 +0100
msvcrt: Don't depend on how __lc_time_data was allocated in _W_Getmonths.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/locale.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 0e3e55b609..52052a4502 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -568,11 +568,14 @@ MSVCRT_wchar_t* CDECL _W_Getmonths(void) { MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr; MSVCRT_wchar_t *out; - int i, len, size; + int i, len, size = 0;
TRACE("\n");
- size = cur->wstr.names.am-cur->wstr.names.short_mon[0]; + for(i=0; i<12; i++) { + size += strlenW(cur->wstr.names.short_mon[i]) + 1; + size += strlenW(cur->wstr.names.mon[i]) + 1; + } out = MSVCRT_malloc((size+1)*sizeof(*out)); if(!out) return NULL;