about summary refs log tree commit diff
path: root/libio/vsnprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/vsnprintf.c')
-rw-r--r--libio/vsnprintf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 9ec06914c0..af901bf3e6 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -38,6 +38,11 @@ _IO_vsnprintf (string, maxlen, format, args)
   _IO_lock_t lock;
   sf._sbf._f._lock = &lock;
 #endif
+
+  /* We need to handle the special case where MAXLEN is 0.  */
+  if (maxlen == 0)
+    return 0;
+
   _IO_init ((_IO_FILE *) &sf, 0);
   _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE *) &sf, string, maxlen - 1, string);