]> git.baikalelectronics.ru Git - uboot.git/commit
fs/squashfs: sqfs_read: Prevent arbitrary code execution
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jun 2022 14:02:06 +0000 (16:02 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 16 Jun 2022 19:22:55 +0000 (15:22 -0400)
commit5e0b8aa3974f20780b6a591cec586d075e1db94d
tree4d2ecceeb23f7a4e7221cf85c98022cec89d50ce
parent417ae89fd530c75da031e5c8eaefe6a5b49e4c89
fs/squashfs: sqfs_read: Prevent arbitrary code execution

Following Jincheng's report, an out-of-band write leading to arbitrary
code execution is possible because on one side the squashfs logic
accepts directory names up to 65535 bytes (u16), while U-Boot fs logic
accepts directory names up to 255 bytes long.

Prevent such an exploit from happening by capping directory name sizes
to 255. Use a define for this purpose so that developers can link the
limitation to its source and eventually kill it some day by dynamically
allocating this array (if ever desired).

Link: https://lore.kernel.org/all/CALO=DHFB+yBoXxVr5KcsK0iFdg+e7ywko4-e+72kjbcS8JBfPw@mail.gmail.com
Reported-by: Jincheng Wang <jc.w4ng@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Jincheng Wang <jc.w4ng@gmail.com>
fs/squashfs/sqfs.c
include/fs.h