diff options
author | Manish Katiyar <mkatiyar@gmail.com> | 2008-07-11 17:45:07 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 17:45:07 -0400 |
commit | 49b4670e5c794f3c0f6f5df61dfa199d6cc7de65 (patch) | |
tree | 9098f50aa02aa7ac6e2965d615e396a9b866b84d | |
parent | adc4e77d89d9a423c3fbe6457676b020c9ad3a64 (diff) | |
download | android_external_e2fsprogs-49b4670e5c794f3c0f6f5df61dfa199d6cc7de65.tar.gz android_external_e2fsprogs-49b4670e5c794f3c0f6f5df61dfa199d6cc7de65.tar.bz2 android_external_e2fsprogs-49b4670e5c794f3c0f6f5df61dfa199d6cc7de65.zip |
libext2fs: Add stricter/earlier tests for blocksize in ext2fs_open()
Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/openfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index fc54afed..525693ec 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -232,11 +232,12 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, } } - fs->blocksize = EXT2_BLOCK_SIZE(fs->super); - if (fs->blocksize == 0) { + if ((fs->super->s_log_block_size + EXT2_MIN_BLOCK_LOG_SIZE) > + EXT2_MAX_BLOCK_LOG_SIZE) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup; } + fs->blocksize = EXT2_BLOCK_SIZE(fs->super); if (EXT2_INODE_SIZE(fs->super) < EXT2_GOOD_OLD_INODE_SIZE) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup; |