summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/vfprintf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 0f35de6644..32ad9d85ab 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1096,6 +1096,12 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	len = __wcrtomb (buf, (fspec == NULL ? va_arg (ap, wint_t)	      \
 			       : args_value[fspec->data_arg].pa_wchar),	      \
 			 &mbstate);					      \
+	if (len == (size_t) -1)						      \
+	  {								      \
+	    /* Something went wron gduring the conversion.  Bail out.  */     \
+	    done = -1;							      \
+	    goto all_done;						      \
+	  }								      \
 	width -= len;							      \
 	if (!left)							      \
 	  PAD (' ');							      \