From: Michael Gernoth Date: Sun, 1 Feb 2009 13:55:54 +0000 (+0100) Subject: more paranoia (check consistency after patching the image, too) X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/79234162193c0989dcb04d11b47683f9dca3563d more paranoia (check consistency after patching the image, too) --- 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;