Piotr Caban : msvcrt: Don't depend on how __lc_time_data was allocated in _Getmonths.

Alexandre Julliard julliard at winehq.org
Wed Dec 4 16:13:04 CST 2019


Module: wine
Branch: master
Commit: e4f3dea2e835f8791b015dd4e6b7a7e224b2c0ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e4f3dea2e835f8791b015dd4e6b7a7e224b2c0ba

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Dec  4 15:30:08 2019 +0100

msvcrt: Don't depend on how __lc_time_data was allocated in _Getmonths.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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 617d1fffb3..0e3e55b609 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -530,12 +530,15 @@ MSVCRT_wchar_t* CDECL _W_Getdays(void)
 char* CDECL _Getmonths(void)
 {
     MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr;
-    int i, len, size;
+    int i, len, size = 0;
     char *out;
 
     TRACE("\n");
 
-    size = cur->str.names.am-cur->str.names.short_mon[0];
+    for(i=0; i<12; i++) {
+        size += strlen(cur->str.names.short_mon[i]) + 1;
+        size += strlen(cur->str.names.mon[i]) + 1;
+    }
     out = MSVCRT_malloc(size+1);
     if(!out)
         return NULL;




More information about the wine-cvs mailing list