]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
e2fsck: require i_size == fscrypt_symlink_data.len + 2
authorEric Biggers <ebiggers@google.com>
Sat, 3 Mar 2018 00:59:19 +0000 (16:59 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 3 Mar 2018 22:09:25 +0000 (17:09 -0500)
commit203be6feb53e545bd5972b99713dd1f95c2b2763
treeb48d34b00b403347e9874e0b6de907ae66b17607
parent22be59d16bdee1748b7d73f8c49dc4525c6cccff
e2fsck: require i_size == fscrypt_symlink_data.len + 2

e2fsck validates that unencrypted symlinks have their strlen() equal to
i_size.  But it skips the equivalent check of i_size ==
fscrypt_symlink_data.len + 2 for encrypted symlinks.  Actually, the
encrypted symlink header is redundant with i_size and shouldn't exist.
But it's there, and the kernel does in fact use the length in the header
instead of i_size -- so e2fsck should validate the header.

Thus, remove the exception for encrypted symlinks, so e2fsck will now
require i_size == fscrypt_symlink_data.len + 2.  I think the exception
was only there originally because for encrypted fast symlinks we were
calculating the length using strnlen() which was wrong.  But that was
fixed by the previous patch.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c