]> 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)
committerSamanta Navarro <ferivoz@riseup.net>
Fri, 20 Jan 2023 12:05:48 +0000 (12:05 +0000)
commitf8325a3f5c4cd614ec1d5bd6b3275adc33df188d
tree96ffe32d04418bec466966e24a7e4f7b6946f650
parent77da12e7b4e0e33fe02e735a7907784cc346164e
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