summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/stdio/printf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 06cf6a5b2..e031f8cb9 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -558,7 +558,8 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap)
if (preci < 0) {
preci = 6;
}
- cnt += __dtostr(op, max_size,
+ cnt += __dtostr(op,
+ (max_size > cnt ? max_size - cnt : 0),
(long double) ((lval > 1)
? va_arg(ap, long double)
: va_arg(ap, double)),