(process_string_arg): Check result of wcrtomb call and bail out if it failed.
authordrepper <drepper>
Fri, 7 Jul 2000 06:03:52 +0000 (06:03 +0000)
committerdrepper <drepper>
Fri, 7 Jul 2000 06:03:52 +0000 (06:03 +0000)
stdio-common/vfprintf.c

index 0f35de6..32ad9d8 100644 (file)
@@ -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 (' ');                                                          \