From b4f7d8b1566e3220d0e9004499ef9c257e079c57 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 7 Aug 2024 15:30:11 +0200 Subject: Merging upstream version 1.22.7. Signed-off-by: Daniel Baumann --- lib/compat/vasprintf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/compat/vasprintf.c') diff --git a/lib/compat/vasprintf.c b/lib/compat/vasprintf.c index 9d53a32..b5a2783 100644 --- a/lib/compat/vasprintf.c +++ b/lib/compat/vasprintf.c @@ -19,6 +19,8 @@ #include +#include +#include #include #include #include @@ -36,7 +38,9 @@ vasprintf(char **strp, char const *fmt, va_list args) needed = vsnprintf(NULL, 0, fmt, args_copy); va_end(args_copy); - if (needed < 0) { + if (needed < 0 || needed >= INT_MAX) { + if (needed >= INT_MAX) + errno = EOVERFLOW; *strp = NULL; return -1; } -- cgit v1.2.3