Added extracting message and CRC-32 check when method is store master
authorRobert Pengelly <robertapengelly@hotmail.com>
Fri, 3 Oct 2025 11:09:05 +0000 (12:09 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Fri, 3 Oct 2025 11:09:05 +0000 (12:09 +0100)
unzip.c

diff --git a/unzip.c b/unzip.c
index 8d69f049176ba7b509933c2361fbb174b8296e66..33d957bc429ccf2bbd7c59a46145639d075f4d8f 100755 (executable)
--- 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);