]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit - e2fsck/pass2.c
e2fsck: salvage under-sized dirents by removing them
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 29 Jan 2015 16:09:07 +0000 (11:09 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 29 Jan 2015 16:09:07 +0000 (11:09 -0500)
commit4a3dc1f0b670960acd570ee64acb436c254135c8
tree5b0db09b2c1385da61b5f8370f9ec20a8db1f2bd
parente274cc39b91f5b0674eac922b22b29b857442194
e2fsck: salvage under-sized dirents by removing them

If the directory processing code ends up pointing to a directory entry
that's so close to the end of the block that there's not even space
for a rec_len/name_len, just substitute dummy values that will force
e2fsck to extend the previous entry to cover the remaining space.  We
can't use the helper methods to extract rec_len because that's reading
off the end of the buffer.

This isn't an issue with non-inline directories because the directory
check buffer is zero-extended so that fsck won't blow up.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass2.c
lib/ext2fs/ext2_fs.h
tests/f_trunc_dirent_header/expect.1 [new file with mode: 0644]
tests/f_trunc_dirent_header/expect.2 [new file with mode: 0644]
tests/f_trunc_dirent_header/image.gz [new file with mode: 0644]
tests/f_trunc_dirent_header/name [new file with mode: 0644]