mirror of
https://xff.cz/git/u-boot/
synced 2025-10-26 16:13:55 +01:00
tools: kwbimage: Verify size of v0 image header
Check that extended image header size is not larger than file size. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
@@ -1670,6 +1670,9 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size,
|
||||
if (mhdr->ext & 0x1) {
|
||||
struct ext_hdr_v0 *ext_hdr;
|
||||
|
||||
if (header_size + sizeof(*ext_hdr) > image_size)
|
||||
return -FDT_ERR_BADSTRUCTURE;
|
||||
|
||||
ext_hdr = (struct ext_hdr_v0 *)
|
||||
(ptr + sizeof(struct main_hdr_v0));
|
||||
checksum = image_checksum8(ext_hdr,
|
||||
|
||||
Reference in New Issue
Block a user