summaryrefslogtreecommitdiff
path: root/pkg/unzip/patch/0004-Handle-the-PKWare-verification-bit-of-internal-attri.patch
blob: 60ce4cdaf78d4d922c44d8c9c6e9501b138016dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From af50c278c5b2c57a76771825a80ca3ff9d315acd Mon Sep 17 00:00:00 2001
From: "Steven M. Schweda" <sms@antinode.info>
Date: Sat, 15 Jun 2019 18:13:11 -0700
Subject: [PATCH] Handle the PKWare verification bit of internal attributes

---
 process.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/process.c b/process.c
index 1e9a1e1..ed314e1 100644
--- a/process.c
+++ b/process.c
@@ -1729,6 +1729,13 @@ int process_cdir_file_hdr(__G)    /* return PK-type error code */
     else if (uO.L_flag > 1)   /* let -LL force lower case for all names */
         G.pInfo->lcflag = 1;
 
+    /* Handle the PKWare verification bit, bit 2 (0x0004) of internal
+       attributes.  If this is set, then a verification checksum is in the
+       first 3 bytes of the external attributes.  In this case all we can use
+       for setting file attributes is the last external attributes byte. */
+    if (G.crec.internal_file_attributes & 0x0004)
+      G.crec.external_file_attributes &= (ulg)0xff;
+
     /* do Amigas (AMIGA_) also have volume labels? */
     if (IS_VOLID(G.crec.external_file_attributes) &&
         (G.pInfo->hostnum == FS_FAT_ || G.pInfo->hostnum == FS_HPFS_ ||
-- 
2.20.1