[PATCH] ext4: Fix integer overflow in ext4fs_read_symlink()
authorRichard Weinberger <richard@nod.at>
Fri, 9 Aug 2024 09:54:28 +0000 (11:54 +0200)
committerDaniel Leidert <dleidert@debian.org>
Sun, 29 Jun 2025 00:33:57 +0000 (02:33 +0200)
commit4c2aa75d33292a975b559d6acfeddd21086dd4a3
tree791a11c862b7ffec26394641d7d3acbcf7d1d712
parent965effba5a096f7eea7850cdfe1cad161df1eeb7
[PATCH] ext4: Fix integer overflow in ext4fs_read_symlink()

While zalloc() takes a size_t type, adding 1 to the le32 variable
will overflow.
A carefully crafted ext4 filesystem can exhibit an inode size of 0xffffffff
and as consequence zalloc() will do a zero allocation.

Later in the function the inode size is again used for copying data.
So an attacker can overwrite memory.

Avoid the overflow by using the __builtin_add_overflow() helper.

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-By: Daniel Leidert <dleidert@debian.org>
Origin: https://source.denx.de/u-boot/u-boot/-/commit/35f75d2a46e5859138c83a75cd2f4141c5479ab9
Bug: https://www.openwall.com/lists/oss-security/2025/02/17/2
Bug-Debian: https://bugs.debian.org/1098254
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2024-57256
Bug-Freexian-Security: https://deb.freexian.com/extended-lts/tracker/CVE-2024-57256

Gbp-Pq: Name CVE-2024-57256.patch
fs/ext4/ext4_common.c