From: Eric Biggers Date: Sat, 3 Mar 2018 00:59:16 +0000 (-0800) Subject: e2fsck: fix reading fscrypt_symlink_data.len X-Git-Tag: v1.44.0-rc2~7^2~1 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=6471c19d8edc66ef85c03f83502fc673e7313f74;p=tools%2Fe2fsprogs.git e2fsck: fix reading fscrypt_symlink_data.len The ciphertext length field stored at the beginning of encrypted symlink targets is 16-bit. But e2fsck_pass1_check_symlink() is reading it as 32-bit. This was apparently left over from an earlier on-disk format that was not merged. Fix it. This bug caused a small proportion of encrypted symlinks with 4092-byte targets to be considered invalid by e2fsck, but otherwise had no effect. Fixes: 62ad24802c6e ("e2fsck: handle encrypted directories which are indexed using htree") Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 7a82536..421fa28 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -239,7 +239,7 @@ int e2fsck_pass1_check_symlink(ext2_filsys fs, ext2_ino_t ino, return 0; if (inode->i_flags & EXT4_ENCRYPT_FL) { - len = ext2fs_le32_to_cpu(*((__u32 *)buf)) + 4; + len = ext2fs_le16_to_cpu(*((__u16 *)buf)) + 2; } else { len = strnlen(buf, fs->blocksize); }