From bdf16c4cb97ab5a0cdd8ce35a5917726a86edd49 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Sat, 24 Nov 2012 00:00:05 +0530 Subject: [PATCH] Avoid CRC32 when decompressing older version archives. --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 9b17589..52f80bd 100644 --- a/main.c +++ b/main.c @@ -350,7 +350,7 @@ redo: sem_post(&tdat->cmp_done_sem); return; } - } else { + } else if (mac_bytes > 0) { /* * Verify header CRC32 in non-crypto mode. */ @@ -652,6 +652,9 @@ start_decompress(const char *filename, const char *to_filename) UNCOMP_BAIL; } + if (version < 5) + mac_bytes = 0; + /* * If encryption is enabled initialize crypto. */ @@ -785,7 +788,7 @@ start_decompress(const char *filename, const char *to_filename) close(uncompfd); unlink(to_filename); err_exit(0, "Header verification failed! File tampered or wrong password.\n"); } - } else { + } else if (version >= 5) { uint32_t crc1, crc2; unsigned int hlen; unsigned short d1;