summaryrefslogtreecommitdiff
path: root/e2fsck/pass2.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-10-21 23:27:03 -0400
committerTheodore Ts'o <tytso@mit.edu>2006-10-21 23:27:03 -0400
commit977ac8731bf3bd934421dd8107e77325ec7e6de7 (patch)
treee57f0f4d7f27ef27740a72e6a1fe773dd1a7845e /e2fsck/pass2.c
parente10521444d34a418febca4b406f5109ff4256ba3 (diff)
downloade2fsprogs-977ac8731bf3bd934421dd8107e77325ec7e6de7.tar.gz
Fix potential e2fsck -n crash
Don't core dump if there is a corrupt htree interior node. If the block number is larger than the number of blocks in the directory, don't write past the end of malloc'ed memory. Addresses SourceForge Bug: #1512778 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass2.c')
-rw-r--r--e2fsck/pass2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index a4db03fd..e47e9500 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -587,11 +587,12 @@ static void parse_int_node(ext2_filsys fs,
#endif
blk = ext2fs_le32_to_cpu(ent[i].block) & 0x0ffffff;
/* Check to make sure the block is valid */
- if (blk > (blk_t) dx_dir->numblocks) {
+ if (blk >= (blk_t) dx_dir->numblocks) {
cd->pctx.blk = blk;
if (fix_problem(cd->ctx, PR_2_HTREE_BADBLK,
&cd->pctx))
goto clear_and_exit;
+ continue;
}
if (hash < prev_hash &&
fix_problem(cd->ctx, PR_2_HTREE_HASH_ORDER, &cd->pctx))