Fix fwrite() reading beyond end of buffer in error path
commit3d110c7c6e6549bd4124fce49cdc672f9e449799
authorEric Biggers <ebiggers3@gmail.com>
Fri, 11 Oct 2013 16:59:38 +0000 (11 22:29 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Fri, 11 Oct 2013 16:59:38 +0000 (11 22:29 +0530)
tree465a14f8a2e1c8e58f470c2550a524fff481228e
parent75b4202ab03337edb37536e3d9470a48a04c9341
Fix fwrite() reading beyond end of buffer in error path

Partially revert commits 2b766585f9b4ffabeef2f36200c275976b93f2c7 and
de2fd463b1c0310d75084b6d774fb974075a4ad9, which were intended to fix BZ#11741
but caused another, likely worse bug, namely that fwrite() and fputs() could,
in an error path, read data beyond the end of the specified buffer, and
potentially even write this data to the file.

Fix BZ#11741 properly by checking the return value from _IO_padn() in
stdio-common/vfprintf.c.
ChangeLog
NEWS
libio/fileops.c
libio/iofwrite.c
libio/iofwrite_u.c
libio/iopadn.c
libio/iowpadn.c
stdio-common/vfprintf.c