summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index bfbdc13..4ad0ee1 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ctype.h>
+#include <errno.h>
#include <limits.h>
#include <locale.h>
#include <stddef.h>
@@ -480,6 +481,7 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
if ((n = fmt - cp) != 0) {
if ((unsigned)ret + n > INT_MAX) {
ret = EOF;
+ errno = EOVERFLOW;
goto error;
}
PRINT(cp, n);
@@ -935,6 +937,7 @@ number: if ((dprec = prec) >= 0)
prsize = width > realsz ? width : realsz;
if ((unsigned)ret + prsize > INT_MAX) {
ret = EOF;
+ errno = EOVERFLOW;
goto error;
}
OpenPOWER on IntegriCloud