From: Robert Pengelly Date: Fri, 3 Oct 2025 11:09:05 +0000 (+0100) Subject: Added extracting message and CRC-32 check when method is store X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=HEAD;p=unzip.git Added extracting message and CRC-32 check when method is store --- diff --git a/unzip.c b/unzip.c index 8d69f04..33d957b 100755 --- a/unzip.c +++ b/unzip.c @@ -947,6 +947,8 @@ static void extract_zip (const char *path) { } + printf (" extracting: %s\n", temp); + if (fwrite (data, 1, cfh.uncomp_size, outfile) != cfh.uncomp_size) { report_at (program_name, 0, REPORT_ERROR, "failed to extract %s", temp); @@ -959,6 +961,20 @@ static void extract_zip (const char *path) { } + rewind (outfile); + + if (crc32 (outfile) != cfh.crc32) { + + report_at (program_name, 0, REPORT_ERROR, "%s: CRC-32 mismatch!", temp); + fclose (outfile); + + free (data); + remove (temp); + + break; + + } + free (data); fclose (outfile);