From: Eric Sandeen Date: Fri, 10 Oct 2008 22:38:15 +0000 (-0500) Subject: resize2fs: check for bogus new_size X-Git-Tag: v1.41.3~6 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=279a000fdcfd5fa79f18c975978d1c6bfa3113a3;p=tools%2Fe2fsprogs.git resize2fs: check for bogus new_size If we don't check for new_size == 0, bogus values send resize2fs into a tailspin: resize2fs 1.41.0 (10-Jul-2008) Illegal block number passed to ext2fs_test_block_bitmap #1 for block bitmap for /tmp/tmp.lntZtMFvz8/fake-disk ...the same message repeated zillion times... Probably should see where that loop is, but at any rate we should error-check parse_num_blocks. Thanks to Petr Muller for reporting this. Addresses-Red-Hat-Bugzilla: #465984 Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- diff --git a/resize/main.c b/resize/main.c index d6ecd8b..3de333e 100644 --- a/resize/main.c +++ b/resize/main.c @@ -376,6 +376,11 @@ int main (int argc, char ** argv) else if (new_size_str) { new_size = parse_num_blocks(new_size_str, fs->super->s_log_block_size); + if (new_size == 0) { + com_err(program_name, 0, + _("Invalid new size: %s\n"), new_size_str); + exit(1); + } } else { new_size = max_size; /* Round down to an even multiple of a pagesize */