diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-03-13 21:22:24 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-03-13 21:24:16 +0100 |
commit | 54c0b9b9dbf72467f099291950680ff8270b02ad (patch) | |
tree | 867839d92f5a70d01493a5a26c7e23581aed9369 /ext2fs/getblk.c | |
parent | 5ff93bc7b5727024394a75defbabb0bff9a2820b (diff) |
ext2fs: Trap trying to access bogus data areas
i.e. superblock, block group descriptor table or beyond the end.
Diffstat (limited to 'ext2fs/getblk.c')
-rw-r--r-- | ext2fs/getblk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c index 00a35135..7c94d87f 100644 --- a/ext2fs/getblk.c +++ b/ext2fs/getblk.c @@ -98,6 +98,10 @@ ext2_alloc_block (struct node *node, block_t goal, int zero) &diskfs_node_disknode (node)->info.i_prealloc_count, &diskfs_node_disknode (node)->info.i_prealloc_block); } + + /* Trap trying to allocate superblock, block group descriptor table, or beyond the end */ + assert_backtrace (result >= group_desc_block_end + && result < store->size >> log2_block_size); #else result = ext2_new_block (goal, 0, 0); #endif |