mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Fix fwrite() reading beyond end of buffer in error path
Partially revert commits2b766585f9
andde2fd463b1
, 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.
This commit is contained in:
committed by
Siddhesh Poyarekar
parent
75b4202ab0
commit
3d110c7c6e
@ -59,7 +59,7 @@ _IO_padn (fp, pad, count)
|
||||
w = _IO_sputn (fp, padptr, PADSIZE);
|
||||
written += w;
|
||||
if (w != PADSIZE)
|
||||
return w == EOF ? w : written;
|
||||
return written;
|
||||
}
|
||||
|
||||
if (i > 0)
|
||||
|
Reference in New Issue
Block a user