summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorRuediger Meier2018-01-23 16:59:23 +0100
committerKarel Zak2018-01-24 12:53:31 +0100
commit2374b1ab75c66c9ecea86fc97abb6d6c048bcf45 (patch)
tree522a10d56c5b963514f76fc2577481d902c1350d /disk-utils
parentRevert "fsck.cramfs: Fix bus error on broken file system." (diff)
downloadkernel-qcow2-util-linux-2374b1ab75c66c9ecea86fc97abb6d6c048bcf45.tar.gz
kernel-qcow2-util-linux-2374b1ab75c66c9ecea86fc97abb6d6c048bcf45.tar.xz
kernel-qcow2-util-linux-2374b1ab75c66c9ecea86fc97abb6d6c048bcf45.zip
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 <tobias@stoeckmann.org> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/fsck.cramfs.c2
1 files changed, 1 insertions, 1 deletions
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);