From 79234162193c0989dcb04d11b47683f9dca3563d Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Sun, 1 Feb 2009 14:55:54 +0100 Subject: [PATCH] more paranoia (check consistency after patching the image, too) --- firmware.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firmware.c b/firmware.c index fb5b007..6056111 100644 --- a/firmware.c +++ b/firmware.c @@ -501,6 +501,11 @@ int main(int argc, char **argv) *((unsigned int*)(fw + statbuf.st_size - 4)) = crc; } + if (check_image(fw, statbuf.st_size-4) != 0) { + fprintf(stderr, "corrupt firmware image found (pdata is not last entry), aborting!\n"); + exit(1); + } + if (check_crc(fw, statbuf.st_size) == 0) { char *newfile; -- 2.39.5