Bug ID: 20231
Summary: vdprintf_chk() does not return EOF when writing to
Assignee: unassigned at sourceware dot org
Reporter: keas11 at otenet dot gr
Target Milestone: ---
The vdprintf_chk() in debug/vdprintf_chk.c does not return EOF when writing to
a closed file. It instead returns the number of characters that would have been
Comparing the code in vdprintf_chk() with that in _IO_vdprintf()
(libio/iovdprintf.c), there are two lines in _IO_vdprintf() checking for an EOF
and adjusting the return value that are missing from vdprintf_chk() resulting
in this issue. The rest of the code in the two functions is almost identical.
Adding the missing lines to vdprintf_chk() fixes the issue.
The two lines that are missing are:
And the __lseek64 will return -1/EBADF and thus _IO_new_file_attach will fail.
The code difference with default vdprintf is, in fact, BZ#11319, where
vdprintf_chk does not return an error output error is encountered (the same
example reported on BZ#11319 fails with -D_FORTIFY_SOURCE=2 -O2).
You are receiving this mail because:
You are on the CC list for the bug.