diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:09 +0000 |
commit | 3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c (patch) | |
tree | 9532e637f47d6ff7246ccbabb62d4e2b4b5908df /lib/compat/vasprintf.c | |
parent | Adding debian version 1.22.6. (diff) | |
download | dpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.tar.xz dpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.zip |
Merging upstream version 1.22.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/compat/vasprintf.c')
-rw-r--r-- | lib/compat/vasprintf.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 <config.h> +#include <errno.h> +#include <limits.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -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; } |