Commit 2a2f525e authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

msvcrt: Fix precision handling for string arguments.

parent 3eb0d286
......@@ -1094,6 +1094,8 @@ char*** __cdecl MSVCRT___p__environ(void);
int* __cdecl __p___mb_cur_max(void);
unsigned int* __cdecl __p__fmode(void);
MSVCRT_wchar_t* __cdecl MSVCRT__wcsdup(const MSVCRT_wchar_t*);
MSVCRT_size_t __cdecl MSVCRT_strnlen(const char *,MSVCRT_size_t);
MSVCRT_size_t __cdecl MSVCRT_wcsnlen(const MSVCRT_wchar_t*,MSVCRT_size_t);
MSVCRT_wchar_t*** __cdecl MSVCRT___p__wenviron(void);
INT __cdecl MSVCRT_wctomb(char*,MSVCRT_wchar_t);
char* __cdecl MSVCRT__strdate(char* date);
......
......@@ -165,8 +165,13 @@ static inline int FUNC_NAME(pf_output_format_wstr)(FUNC_NAME(puts_clbk) pf_puts,
{
int r, ret;
if(len < 0)
if(len < 0) {
/* Do not search past the length specified by the precision. */
if(flags->Precision>=0)
len = MSVCRT_wcsnlen(str, flags->Precision);
else
len = strlenW(str);
}
if(flags->Precision>=0 && flags->Precision<len)
len = flags->Precision;
......@@ -190,8 +195,13 @@ static inline int FUNC_NAME(pf_output_format_str)(FUNC_NAME(puts_clbk) pf_puts,
{
int r, ret;
if(len < 0)
if(len < 0) {
/* Do not search past the length specified by the precision. */
if(flags->Precision>=0)
len = MSVCRT_strnlen(str, flags->Precision);
else
len = strlen(str);
}
if(flags->Precision>=0 && flags->Precision<len)
len = flags->Precision;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment