]> git.ipfire.org Git - thirdparty/u-boot.git/commit
tools: imximage: Fix check array index
authorMikhail Ilin <ilin.mikhail.ol@gmail.com>
Tue, 22 Nov 2022 09:34:26 +0000 (12:34 +0300)
committerStefano Babic <sbabic@denx.de>
Mon, 30 Jan 2023 22:23:01 +0000 (23:23 +0100)
commit507a70b1447ae389c614ac3d04ae853922935898
tree6f3a4827b7d6661cac2fd077ac74cce5600bd907
parentbaa7550c14156f9dda65e0c3267f35a0dfc3cf10
tools: imximage: Fix check array index

The struct dcd_v1_t is initialized to MAX_HW_CFG_SIZE_V1 (60)
 structs 'dcd_type_addr_data_t', so the indexes to use on its elements
 are [0,59]. But on line 478, the variable 'length' can take on the value
 60, which applies to array overflow: cd_v1->addr_data[length].type Thus,
 it is necessary to tighten the check on the 'size' variable on line 463.

Fixes: 0b0c6af38738 ("Prepare v2020.01")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
tools/imximage.c