diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2014-07-24 22:19:27 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-07-24 22:19:27 -0400 |
commit | b4f724c8a90987d4785fd1accfe69c125567be39 (patch) | |
tree | 42a13c32119aa6083ec16feceb5d6dab220108d5 /e2fsck | |
parent | b4a40883385d610c55c11de52002bd8f9c2d790e (diff) | |
download | e2fsprogs-b4f724c8a90987d4785fd1accfe69c125567be39.tar.gz |
e2fsck: fix off-by-one bounds check on group number
Since fs->group_desc_count is the number of block groups, the number
of the last group is always one less than this count. Fix the bounds
check to reflect that.
This flaw shouldn't have any user-visible side effects, since the
block bitmap test based on last_grp later on can handle overbig block
numbers.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck')
-rw-r--r-- | e2fsck/pass1.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 7a887de1..cf36a086 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -2653,8 +2653,8 @@ static void new_table_block(e2fsck_t ctx, blk64_t first_block, dgrp_t group, first_block = ext2fs_group_first_block2(fs, flexbg_size * flexbg); last_grp = group | (flexbg_size - 1); - if (last_grp > fs->group_desc_count) - last_grp = fs->group_desc_count; + if (last_grp >= fs->group_desc_count) + last_grp = fs->group_desc_count - 1; last_block = ext2fs_group_last_block2(fs, last_grp); } else last_block = ext2fs_group_last_block2(fs, group); |