From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/time.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 7a110e53455..5b3698357c2 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -1730,7 +1730,8 @@ char * CDECL _ctime64(const __time64_t *time) */ errno_t CDECL _ctime64_s(char *res, size_t len, const __time64_t *time) { - struct tm *t; + struct tm t; + int ret;
if (!MSVCRT_CHECK_PMT( res != NULL )) return EINVAL; if (!MSVCRT_CHECK_PMT( len >= 26 )) return EINVAL; @@ -1738,9 +1739,10 @@ errno_t CDECL _ctime64_s(char *res, size_t len, const __time64_t *time) if (!MSVCRT_CHECK_PMT( time != NULL )) return EINVAL; if (!MSVCRT_CHECK_PMT( *time > 0 )) return EINVAL;
- t = _localtime64( time ); - strcpy( res, asctime( t ) ); - return 0; + ret = _localtime64_s( &t, time ); + if (ret) + return ret; + return asctime_s( res, len, &t ); }
/*********************************************************************
From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/time.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 5b3698357c2..155454c5659 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -1761,7 +1761,8 @@ char * CDECL _ctime32(const __time32_t *time) */ errno_t CDECL _ctime32_s(char *res, size_t len, const __time32_t *time) { - struct tm *t; + struct tm t; + int ret;
if (!MSVCRT_CHECK_PMT( res != NULL )) return EINVAL; if (!MSVCRT_CHECK_PMT( len >= 26 )) return EINVAL; @@ -1769,9 +1770,10 @@ errno_t CDECL _ctime32_s(char *res, size_t len, const __time32_t *time) if (!MSVCRT_CHECK_PMT( time != NULL )) return EINVAL; if (!MSVCRT_CHECK_PMT( *time > 0 )) return EINVAL;
- t = _localtime32( time ); - strcpy( res, asctime( t ) ); - return 0; + ret = _localtime32_s( &t, time ); + if (ret) + return ret; + return asctime_s( res, len, &t ); }
/*********************************************************************
From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/mbcs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 5f5cd3e8cda..bd4245c2c53 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -3322,8 +3322,20 @@ size_t CDECL _mbstowcs_l(wchar_t *wcstr, const char *mbstr, if(mbstr[size] == '\0') break;
- if (locinfo->lc_codepage == CP_UTF8) - size += get_utf8_char_len(mbstr[size]); + if(locinfo->lc_codepage == CP_UTF8) { + int j, chlen = get_utf8_char_len(mbstr[size]); + + for(j = 1; j < chlen; j++) + { + if(!mbstr[size + j]) + { + if(count) wcstr[0] = '\0'; + *_errno() = EILSEQ; + return -1; + } + } + size += chlen; + } else size += (_isleadbyte_l((unsigned char)mbstr[size], locale) ? 2 : 1); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147339
Your paranoid android.
=== debian11b (64 bit WoW report) ===
kernel32: comm.c:1586: Test failed: Unexpected time 1001, expected around 500