aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-09-18 18:39:18 +0200
committerStefan Roese <sr@denx.de>2022-10-06 10:15:35 +0200
commitcbd0043e2093dc9889c696630c118dd7505ec7c7 (patch)
tree6bf8f4e9b640a6cb9e63562fdc8873780cee29a8
parent1ba0018218e141d444d75e9a59e397704292fe68 (diff)
downloadu-boot-cbd0043e2093dc9889c696630c118dd7505ec7c7.zip
u-boot-cbd0043e2093dc9889c696630c118dd7505ec7c7.tar.gz
u-boot-cbd0043e2093dc9889c696630c118dd7505ec7c7.tar.bz2
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 <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r--tools/kwbimage.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 94b7685..6abb9f2 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;