squashfs: Fix integer overflow in sqfs_resolve_symlink()
authorRichard Weinberger <richard@nod.at>
Fri, 2 Aug 2024 16:36:44 +0000 (18:36 +0200)
committerRaspbian forward porter <root@raspbian.org>
Mon, 18 May 2026 02:33:18 +0000 (02:33 +0000)
commit4119ba646f9d09dee491de40604035a50a077446
tree3b4707230ac7e08add6039b4682dceb869d9e35b
parentee6c86f12bff64e2df0db2a5a1f85e8f750bc84b
squashfs: Fix integer overflow in sqfs_resolve_symlink()

A carefully crafted squashfs filesystem can exhibit an inode size of 0xffffffff,
as a consequence malloc() 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: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-By: Daniel Leidert <dleidert@debian.org>
Origin: https://source.denx.de/u-boot/u-boot/-/commit/233945eba63e24061dffeeaeb7cd6fe985278356
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-57255
Bug-Freexian-Security: https://deb.freexian.com/extended-lts/tracker/CVE-2024-57255

Gbp-Pq: Name CVE-2024-57255.patch
fs/squashfs/sqfs.c