Avoid CRC32 when decompressing older version archives.

This commit is contained in:
Moinak Ghosh 2012-11-24 00:00:05 +05:30
parent 817e16cce6
commit bdf16c4cb9

7
main.c
View file

@ -350,7 +350,7 @@ redo:
sem_post(&tdat->cmp_done_sem); sem_post(&tdat->cmp_done_sem);
return; return;
} }
} else { } else if (mac_bytes > 0) {
/* /*
* Verify header CRC32 in non-crypto mode. * Verify header CRC32 in non-crypto mode.
*/ */
@ -652,6 +652,9 @@ start_decompress(const char *filename, const char *to_filename)
UNCOMP_BAIL; UNCOMP_BAIL;
} }
if (version < 5)
mac_bytes = 0;
/* /*
* If encryption is enabled initialize crypto. * If encryption is enabled initialize crypto.
*/ */
@ -785,7 +788,7 @@ start_decompress(const char *filename, const char *to_filename)
close(uncompfd); unlink(to_filename); close(uncompfd); unlink(to_filename);
err_exit(0, "Header verification failed! File tampered or wrong password.\n"); err_exit(0, "Header verification failed! File tampered or wrong password.\n");
} }
} else { } else if (version >= 5) {
uint32_t crc1, crc2; uint32_t crc1, crc2;
unsigned int hlen; unsigned int hlen;
unsigned short d1; unsigned short d1;