Whamcloud - gitweb
libext2fs: avoid potential out-of-bounds write if pread/pread64 fails
authorTheodore Ts'o <tytso@mit.edu>
Tue, 22 Aug 2017 15:23:21 +0000 (11:23 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 22 Aug 2017 15:28:44 +0000 (11:28 -0400)
commit15cb3b973ed67262606e6aa68b3e64c59e997aac
tree808e94c39c0dca684776611b92e1ae81e6fe7ebe
parent3f557ac7c7708ea2a637dba1099dd011d026be5d
libext2fs: avoid potential out-of-bounds write if pread/pread64 fails

In unix_io.c's raw_read_block(), if the initial attempt to call
pread/pread64 fails because the offset is insane, the variable
"actual" is left at -1, and then when lseek fails, the cleanup
function will try to clear (as an out-of-bounds write) a single byte
before the buffer.  Fix this.

Addresses-Debian-Bug: #871539

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Jakub Wilk <jwilk@jwilk.net>
lib/ext2fs/unix_io.c