diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-01-27 12:21:04 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-28 01:56:09 +0000 |
commit | 9bfe2c9f267579454fc63688fde3d023b338d938 (patch) | |
tree | 88983498db55f40f1e9654d4e5b0adc13160ee95 | |
parent | 73e5eb38821d693244f841ce4f0a14546e5b6361 (diff) | |
download | vboot-9bfe2c9f267579454fc63688fde3d023b338d938.tar.gz |
futility: vbutil_kernel should check the kernel a bit more
Trying to repack an invalid kernel blob should notice and
complain that the blob is invalid instead of just segfaulting.
BUG=chromium:452353
BRANCH=ToT
TEST=manual
See the bug report for an example test case. Many more tests are
being added as futility development continues.
Change-Id: I2bbfb8ab41a0f596b25a76f76f74d7b47b7e4a17
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/243583
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | futility/cmd_vbutil_kernel.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c index 3b2643e4..40deba9e 100644 --- a/futility/cmd_vbutil_kernel.c +++ b/futility/cmd_vbutil_kernel.c @@ -21,6 +21,7 @@ #include "futility.h" #include "host_common.h" #include "kernel_blob.h" +#include "traversal.h" #include "vb1_helper.h" static void Fatal(const char *format, ...) @@ -461,6 +462,11 @@ static int do_vbutil_kernel(int argc, char *argv[]) /* Load the kernel partition */ kpart_data = ReadOldKPartFromFileOrDie(oldfile, &kpart_size); + /* Make sure we have a kernel partition */ + if (FILE_TYPE_KERN_PREAMBLE != + futil_what_file_type_buf(kpart_data, kpart_size)) + Fatal("%s is not a kernel blob\n", oldfile); + kblob_data = UnpackKPart(kpart_data, kpart_size, opt_pad, &keyblock, &preamble, &kblob_size); |