]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fsck.cramfs: print correct error on 32-bit systems
authorSamanta Navarro <ferivoz@riseup.net>
Fri, 20 Jan 2023 11:57:15 +0000 (11:57 +0000)
committerKarel Zak <kzak@redhat.com>
Mon, 23 Jan 2023 12:52:00 +0000 (13:52 +0100)
commite0771b1b75c5358a0b529e063d5d80918a738640
treec87ae1f604c0f7912f5658aa5e7638db652efcd1
parent91a484febae74588517226c6e0870562ca430651
fsck.cramfs: print correct error on 32-bit systems

On 32-bit systems the file length check does not handle files correctly
which are larger than 4 GB. Use an unsigned long long which is already
in place for blkdev_get_size.

Proof of Concept:

- Prepare a file containing a CramFS
```
mkdir owo
mkfs.cramfs owo owo.iso
dd if=/dev/zero of=owo.iso bs=1 seek=4294967296 count=1 conv=notrunc
fsck.cramfs owo.iso
```

- Check the file
```
fsck.cramfs owo.iso
```

You will see: `fsck.cramfs: file length too short`
Better message is: `fsck.cramfs: file extends past end of filesystem`

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
disk-utils/fsck.cramfs.c