Signed-off-by: Francois Gouget fgouget@codeweavers.com --- include/msvcrt/corecrt.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index cff4549d376..ea81e95db36 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -158,6 +158,7 @@ #endif
#define _ARGMAX 100 +#define _CRT_INT_MAX 0x7fffffff
#ifndef _MSVCRT_LONG_DEFINED #define _MSVCRT_LONG_DEFINED
When they see -1 they consider that the buffer is too small and return an error. So impose a 2 GB limit on sprintf() for backward compatibility with XP and 2003.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- include/msvcrt/stdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 7477ac171a8..85059b4070b 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -244,7 +244,7 @@ static inline int WINAPIV sprintf(char *buffer, const char *format, ...) __ms_va_list args;
__ms_va_start(args, format); - ret = _vsnprintf(buffer, (size_t)-1, format, args); + ret = _vsnprintf(buffer, (size_t)_CRT_INT_MAX, format, args); __ms_va_end(args); return ret; }