]> git.dujemihanovic.xyz Git - u-boot.git/commit
squashfs: Fix integer overflow in sqfs_resolve_symlink()
authorRichard Weinberger <richard@nod.at>
Fri, 2 Aug 2024 16:36:44 +0000 (18:36 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 15 Aug 2024 22:14:36 +0000 (16:14 -0600)
commit233945eba63e24061dffeeaeb7cd6fe985278356
tree2e35b6347ffc0135cd9b75c181bd6f482eee641c
parent9b9368b5c4dc24b3b999743db26fb915981d26a9
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>
fs/squashfs/sqfs.c