summaryrefslogtreecommitdiffstats
path: root/lib/compat/vasprintf.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:11 +0000
commitb4f7d8b1566e3220d0e9004499ef9c257e079c57 (patch)
treece0468ca8cf21380bef3d2aaacc9fcb30116e757 /lib/compat/vasprintf.c
parentReleasing progress-linux version 1.22.6-0.0~progress7.99u1. (diff)
downloaddpkg-b4f7d8b1566e3220d0e9004499ef9c257e079c57.tar.xz
dpkg-b4f7d8b1566e3220d0e9004499ef9c257e079c57.zip
Merging upstream version 1.22.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lib/compat/vasprintf.c6
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;
}