Arthur Heymans has uploaded this change for review.
util/cbfstool: Validate the bzImage
Check that the bzImage has a valid magic header.
This fixes using cbfstool on invalid kernel images.
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: I5aa75944901d80474fd85fb7fc7ec5dafa5c71fb
---
M util/cbfstool/cbfs-payload-linux.c
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/79981/1
diff --git a/util/cbfstool/cbfs-payload-linux.c b/util/cbfstool/cbfs-payload-linux.c
index 53d455c..d4256e6 100644
--- a/util/cbfstool/cbfs-payload-linux.c
+++ b/util/cbfstool/cbfs-payload-linux.c
@@ -193,6 +193,11 @@
struct linux_header *hdr = (struct linux_header *)input->data;
unsigned int setup_size = 4 * 512;
+ if (strncmp((const char *)hdr->header_magic, "HdrS", 4)) {
+ ERROR("Not a valid Linux Image.\n");
+ return -1;
+ }
+
if (bzp_init(&bzp, algo) != 0)
return -1;
To view, visit change 79981. To unsubscribe, or for help writing mail filters, visit settings.