[PATCH 2/2] msvcrt: Old versions of _vsnprintf() treat the size as a signed int.
Francois Gouget
fgouget at codeweavers.com
Thu Feb 20 12:27:49 CST 2020
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 at 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;
}
--
2.20.1
More information about the wine-devel
mailing list