diff mbox series

[03/10] e2fsck: fix reading fscrypt_symlink_data.len

Message ID 20180303005923.152761-4-ebiggers3@gmail.com
State Accepted, archived
Headers show
Series e2fsprogs: symlink fixes | expand

Commit Message

Eric Biggers March 3, 2018, 12:59 a.m. UTC
From: Eric Biggers <ebiggers@google.com>

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 <ebiggers@google.com>
---
 e2fsck/pass1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Theodore Ts'o March 3, 2018, 8:29 p.m. UTC | #1
On Fri, Mar 02, 2018 at 04:59:16PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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 <ebiggers@google.com>

Thanks, applied.

						- Ted
diff mbox series

Patch

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 5015d938..b101df0a 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -249,7 +249,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);
 		}