]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K
authorToddRK <ToddRK@example.com>
Thu, 28 Jan 2021 11:44:41 +0000 (12:44 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Feb 2021 09:18:11 +0000 (10:18 +0100)
commit25b8d1a25c0072d115bfc4e42ec6620bab6dad91
treed06c91257d402ad656a8ab68ac456051b25aa243
parentc6ec9f8f514c93a64a2340164b1dc323616ee832
fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K

fsck.cramfs crashes when extracting a cramfs image with a 16KB blocksize.
The read_buffer is hardcoded for a 4KB blocksize.  When using a blocksize
larger than 4KB, the program's code uses indexes that go past the end of the
allocated space for the read_buffer and this causes the crash.

The following changes fix the problem for me in the latest 2.36.1 release of
fsck.cramfs.c.  However there are hardcoded values of 4096 in the code that
might cause problems under other circumstances and I have not attempted to
fix those.

[kzak@redhat.com: - some coding style changes to code]

Fixes: https://github.com/karelzak/util-linux/issues/1232
Signed-off-by: ToddRK <ToddRK@example.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fsck.cramfs.c