From 186f1d59d9eb4069a0e6ce6e9fdada014fff1f68 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 13 Jun 2012 17:27:59 +0800 Subject: [PATCH] sbverify: Check for failed image load Currently, sbverify will segfault when it can't load an image file, as the image is used unconditionally. This change adds a check to ensure we continue with a valid image pointer. Signed-off-by: Jeremy Kerr --- sbverify.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sbverify.c b/sbverify.c index 2caec1f..cb8f9b4 100644 --- a/sbverify.c +++ b/sbverify.c @@ -234,6 +234,11 @@ int main(int argc, char **argv) } image = image_load(argv[optind]); + if (!image) { + fprintf(stderr, "Can't open image %s\n", argv[optind]); + return EXIT_FAILURE; + } + image_pecoff_parse(image); image_find_regions(image);