]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - libio/wfileops.c
libio: Ensure output buffer for wchars (bug #28828)
[thirdparty/glibc.git] / libio / wfileops.c
index fb9d45b67793b922c3ca9d2370b50a99d3836334..b59a98881f34b6316292a5c3a8d077dcc269b09b 100644 (file)
@@ -412,7 +412,8 @@ _IO_wfile_overflow (FILE *f, wint_t wch)
       return WEOF;
     }
   /* If currently reading or no buffer allocated. */
-  if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
+  if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0
+      || f->_wide_data->_IO_write_base == NULL)
     {
       /* Allocate a buffer if needed. */
       if (f->_wide_data->_IO_write_base == 0)