From b1263f2c055c9c08296f70b1190054e1590484d3 Mon Sep 17 00:00:00 2001 From: devinacker Date: Fri, 15 Nov 2013 16:23:10 -0500 Subject: [PATCH] fix bad decompression size error --- compress.c | 2 +- exhal.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compress.c b/compress.c index 98f3b43..cbb6940 100644 --- a/compress.c +++ b/compress.c @@ -274,7 +274,7 @@ size_t unpack_from_file (FILE *file, size_t offset, uint8_t *unpacked) { fseek(file, offset, SEEK_SET); fread((void*)packed, DATA_SIZE, 1, file); - if (!feof(file)) + if (!ferror(file)) return unpack(packed, unpacked); return 0; diff --git a/exhal.c b/exhal.c index b905ce0..b429976 100644 --- a/exhal.c +++ b/exhal.c @@ -52,7 +52,7 @@ int main (int argc, char **argv) { } else { fprintf(stderr, "Error: Unable to decompress %s because an invalid offset was specified\n" " (must be between zero and 0x%X).\n", argv[1], ftell(infile)); - outputsize = 0; + exit(-1); } if (outputsize) {