From 2374b1ab75c66c9ecea86fc97abb6d6c048bcf45 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Tue, 23 Jan 2018 16:59:23 +0100 Subject: fsck.cramfs: fix crash when superblock size is too small This hopefully fixes the original problem addressed by the reverted patch 7cb962c7. The bug was introduced by myself in f991dbd3 "fsck.cramfs: allow smaller superblock sizes" CC: Tobias Stoeckmann Signed-off-by: Ruediger Meier --- disk-utils/fsck.cramfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'disk-utils') diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c index 50c7d33b9..820816b14 100644 --- a/disk-utils/fsck.cramfs.c +++ b/disk-utils/fsck.cramfs.c @@ -192,7 +192,7 @@ static void test_super(int *start, size_t * length) errx(FSCK_EX_ERROR, _("unsupported filesystem features")); /* What are valid superblock sizes? */ - if (super.size < sizeof(struct cramfs_super)) + if (super.size < *start + sizeof(struct cramfs_super)) errx(FSCK_EX_UNCORRECTED, _("superblock size (%d) too small"), super.size); -- cgit v1.2.3-55-g7522