aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2017-04-15 10:33:53 -0400
committerJin Qian <jinqian@google.com>2017-08-08 18:21:51 +0000
commit7adf0ece5792f0a3f3cb8bf1a9c1060b7de9c5cd (patch)
treebe4d8ac2b1b9cfbcde8353d9bf54fc54534c1c50
parentf425ce53dda0ccbcb1ea4f71d03fedcf7df24b6f (diff)
downloade2fsprogs-7adf0ece5792f0a3f3cb8bf1a9c1060b7de9c5cd.tar.gz
e2fsck: fix ASAN error when using 128 byte inodes
Due to the inode table buffering, it's actually hard to overrun the end of allocated memory, so the ASAN error doesn't trigger all the time. Google-Bug-Id: 37326362 Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit e251f3585902919e809414a4bd17d6bfdbdaaad1) Change-Id: I54667f781587aebd4ee94b4d09c56c6fb44b6513
-rw-r--r--e2fsck/pass1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index ac4d5544..7c5ae4d5 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1819,9 +1819,14 @@ void e2fsck_pass1(e2fsck_t ctx)
inode->i_block[EXT2_DIND_BLOCK] ||
inode->i_block[EXT2_TIND_BLOCK] ||
ext2fs_file_acl_block(fs, inode))) {
+ struct ext2_inode_large *ip;
+
inodes_to_process[process_inode_count].ino = ino;
- inodes_to_process[process_inode_count].inode =
- *(struct ext2_inode_large *)inode;
+ ip = &inodes_to_process[process_inode_count].inode;
+ if (inode_size < sizeof(struct ext2_inode_large))
+ memcpy(ip, inode, inode_size);
+ else
+ memcpy(ip, inode, sizeof(*ip));
process_inode_count++;
} else
check_blocks(ctx, &pctx, block_buf);