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: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/79234162193c0989dcb04d11b47683f9dca3563d?ds=inline;hp=39dccf16f3018c75476d22311266be8aa5b790bd 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;