From 3c79472a773210127bec1768aaf85e540daa3f9f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 24 Nov 2019 16:41:23 +0100 Subject: Fix check of block size in super block The check needs to include 1M, which is still a valid block size. Signed-off-by: David Oberhollenzer --- lib/sqfs/read_super.c | 2 +- lib/sqfs/super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqfs') diff --git a/lib/sqfs/read_super.c b/lib/sqfs/read_super.c index 437ee07..f5cc988 100644 --- a/lib/sqfs/read_super.c +++ b/lib/sqfs/read_super.c @@ -54,7 +54,7 @@ int sqfs_super_read(sqfs_super_t *super, sqfs_file_t *file) if ((temp.block_size - 1) & temp.block_size) return SQFS_ERROR_SUPER_BLOCK_SIZE; - if (temp.block_size < 4096 || temp.block_size >= (1 << 20)) + if (temp.block_size < 4096 || temp.block_size > (1 << 20)) return SQFS_ERROR_SUPER_BLOCK_SIZE; if (temp.block_log < 12 || temp.block_log > 20) diff --git a/lib/sqfs/super.c b/lib/sqfs/super.c index 20ce420..4ed95ae 100644 --- a/lib/sqfs/super.c +++ b/lib/sqfs/super.c @@ -20,7 +20,7 @@ int sqfs_super_init(sqfs_super_t *super, size_t block_size, sqfs_u32 mtime, if (block_size & (block_size - 1)) return SQFS_ERROR_SUPER_BLOCK_SIZE; - if (block_size < 4096 || block_size >= (1 << 20)) + if (block_size < 4096 || block_size > (1 << 20)) return SQFS_ERROR_SUPER_BLOCK_SIZE; memset(super, 0, sizeof(*super)); -- cgit v1.2.3