glibc/glibc-rh455360.patch
Jakub Jelinek 005e850828 2.8-8
2008-07-16 14:58:16 +00:00

31 lines
1.0 KiB
Diff

2008-07-15 Ulrich Drepper <drepper@redhat.com>
* stdio-common/vfprintf.c (_IO_helper_overflow): In case _IO_sputn
doesn't manage to write anything, fail.
--- libc/stdio-common/vfprintf.c 8 Apr 2008 07:59:50 -0000 1.128.2.13
+++ libc/stdio-common/vfprintf.c 16 Jul 2008 09:47:15 -0000
@@ -2080,6 +2080,11 @@ _IO_helper_overflow (_IO_FILE *s, int c)
{
_IO_size_t written = _IO_sputn (target, s->_wide_data->_IO_write_base,
used);
+ if (written == 0 || written == WEOF)
+ return WEOF;
+ __wmemmove (s->_wide_data->_IO_write_base,
+ s->_wide_data->_IO_write_base + written,
+ used - written);
s->_wide_data->_IO_write_ptr -= written;
}
#else
@@ -2087,6 +2092,10 @@ _IO_helper_overflow (_IO_FILE *s, int c)
if (used)
{
_IO_size_t written = _IO_sputn (target, s->_IO_write_base, used);
+ if (written == 0 || written == EOF)
+ return EOF;
+ memmove (s->_IO_write_base, s->_IO_write_base + written,
+ used - written);
s->_IO_write_ptr -= written;
}
#endif