From c7bc78bfd9f21bd306c34a405bd7e8b2e81b644e Mon Sep 17 00:00:00 2001 From: w4123 <1840686745@qq.com> Date: Sat, 23 Nov 2024 03:57:34 +0000 Subject: [PATCH] Fix capability bound issue in ext2fs --- sys/fs/ext2fs/ext2_htree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c index 02a5fd93cb5b..dd5de50ae45f 100644 --- a/sys/fs/ext2fs/ext2_htree.c +++ b/sys/fs/ext2fs/ext2_htree.c @@ -300,7 +300,9 @@ ext2_htree_find_leaf(struct inode *ip, const char *name, int namelen, if ((levels = rootp->h_info.h_ind_levels) > 1) goto error; - entp = (struct ext2fs_htree_entry *)(((char *)&rootp->h_info) + + /* Preserve capability bound here. */ + entp = (struct ext2fs_htree_entry *)(((char *)rootp) + + offsetof(struct ext2fs_htree_root, h_info) + rootp->h_info.h_info_len); if (ext2_htree_get_limit(entp) !=