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 <jeremy.kerr@canonical.com>
This commit is contained in:
parent
0568983fab
commit
186f1d59d9
1 changed files with 5 additions and 0 deletions
|
@ -234,6 +234,11 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
image = image_load(argv[optind]);
|
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_pecoff_parse(image);
|
||||||
image_find_regions(image);
|
image_find_regions(image);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue