[PATCH] squashfs: Fix stack overflow while symlink resolving
authorRichard Weinberger <richard@nod.at>
Fri, 2 Aug 2024 16:36:47 +0000 (18:36 +0200)
committerRaspbian forward porter <root@raspbian.org>
Mon, 18 May 2026 02:33:18 +0000 (02:33 +0000)
commitf26e06148d4e425fd777d422a304ee79b9175e86
tree8c496adab6d3922e3bae7470b6a1b5535a13495b
parentf1c0d2cb6781408725bf4d072b51ef246a097735
[PATCH] squashfs: Fix stack overflow while symlink resolving

The squashfs driver blindly follows symlinks, and calls sqfs_size()
recursively. So an attacker can create a crafted filesystem and with
a deep enough nesting level a stack overflow can be achieved.

Fix by limiting the nesting level to 8.

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/4f5cc096bfd0a591f8a11e86999e3d90a9484c34
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-57257
Bug-Freexian-Security: https://deb.freexian.com/extended-lts/tracker/CVE-2024-57257

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