From b33d2fc41420eb44c02e422ec63f8d4b5ab231df Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Fri, 3 Oct 2025 12:09:05 +0100 Subject: [PATCH] Added extracting message and CRC-32 check when method is store --- unzip.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); -- 2.34.1