summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-03-18 01:16:37 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-03-18 01:16:37 +0100
commitf5eb71362af4104f6c0e3bdae9e2a89159094016 (patch)
tree64ef67cc587a47f1762ad26a022a5b7fbc1f69c1
parent884a0bfc2b0ec1ff25d5120f9bfbccfeee8e5b0e (diff)
ext2fs: Trap trying to access bogus data areas
i.e. superblock, block group descriptor table or beyond the end.
-rw-r--r--ext2fs/getblk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c
index 7c94d87f..26ac145e 100644
--- a/ext2fs/getblk.c
+++ b/ext2fs/getblk.c
@@ -130,7 +130,12 @@ inode_getblk (struct node *node, int nr, int create, int zero,
*result = diskfs_node_disknode (node)->info.i_data[nr];
if (*result)
- return 0;
+ {
+ /* Trap trying to access superblock, block group descriptor table, or beyond the end */
+ assert_backtrace (*result >= group_desc_block_end
+ && *result < store->size >> log2_block_size);
+ return 0;
+ }
if (!create)
return EINVAL;