summaryrefslogtreecommitdiff
path: root/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'printf.c')
-rw-r--r--printf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/printf.c b/printf.c
index 370c8e9b0..4288f0241 100644
--- a/printf.c
+++ b/printf.c
@@ -145,6 +145,12 @@ mpfr_snprintf (char *buf, size_t size, const char *fmt, ...)
{
va_list ap;
int ret;
+
+ if (size == 0)
+ return 0;
+
+ MPFR_ASSERTD (buf != NULL);
+
va_start (ap, fmt);
ret = mpfr_vsnprintf (buf, size, fmt, ap);