sunxi-tools: prevent possible out-of-bounds memory access
This patch is to prevent the call to aw_fel_write_uboot_image() with insufficient file size. If a user passes a boot file smaller than 32K, e.g. on "fel spl sunxi-spl.bin", the expression (size - SPL_LEN_LIMIT) would end up negative, and causes a numeric underflow when passed to aw_fel_write_uboot_image() as "size_t len". This might incorrectly let that function assume a u-boot binary was passed, when actually it isn't supposed to act on the buffer at all. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Please register or sign in to comment