From: Pali Rohár Date: Sun, 18 Sep 2022 16:39:18 +0000 (+0200) Subject: tools: kwbimage: Verify maximal kwbimage header size X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=cbd0043e2093dc9889c696630c118dd7505ec7c7;p=u-boot.git tools: kwbimage: Verify maximal kwbimage header size BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 94b7685392..6abb9f2d5c 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -1969,6 +1969,9 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size, uint32_t size; uint8_t csum; + if (header_size > 192*1024) + return -FDT_ERR_BADSTRUCTURE; + if (header_size > image_size) return -FDT_ERR_BADSTRUCTURE;