]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwbimage: Verify maximal kwbimage header size
authorPali Rohár <pali@kernel.org>
Sun, 18 Sep 2022 16:39:18 +0000 (18:39 +0200)
committerStefan Roese <sr@denx.de>
Thu, 6 Oct 2022 08:15:35 +0000 (10:15 +0200)
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwbimage.c

index 94b76853922296a1c258e3b66f53008a341d5730..6abb9f2d5c01343eb2122b8159dc891d23c64452 100644 (file)
@@ -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;