From: "Pali Rohár" <pali@kernel.org>
To: "Stefan Roese" <sr@denx.de>, "Marek Behún" <kabel@kernel.org>
Cc: u-boot@lists.denx.de
Subject: [PATCH] tools: kwbimage: Verify maximal kwbimage header size
Date: Sun, 18 Sep 2022 18:39:18 +0200 [thread overview]
Message-ID: <20220918163918.7323-1-pali@kernel.org> (raw)
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
tools/kwbimage.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 94b768539222..6abb9f2d5c01 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;
--
2.20.1
next reply other threads:[~2022-09-18 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 16:39 Pali Rohár [this message]
2022-09-19 7:05 ` [PATCH] tools: kwbimage: Verify maximal kwbimage header size Stefan Roese
2022-10-06 10:42 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220918163918.7323-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=kabel@kernel.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox