]> 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>
Thu, 28 Jan 2021 11:46:49 +0000 (12:46 +0100)
commitdeba6720fb96951bf81338363eb9e6c2f352ffd3
treeaf9a982ce6fb225ef826ea00d95ee48e88e86370
parent867df2617cdf2a0eca0778c016ac684ead7c91c7
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