From: datauwu Date: Sun, 5 Jul 2026 05:22:03 +0000 (+0800) Subject: zip: read PKWARE Unix extra field metadata X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=467d31b0cf47d86baeec92dae772bfa93e8123b3;p=thirdparty%2Flibarchive.git zip: read PKWARE Unix extra field metadata Read the fixed metadata prefix of the PKWARE Unix extra field 0x000d. The fixed portion contains atime, mtime, uid, and gid values. Require the full 12-byte prefix before reading it, and leave the variable-length data field unsupported for now. --- diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 73b8a6640..d0afaabc0 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -756,6 +756,22 @@ process_extra(struct archive_read *a, struct archive_entry *entry, * on which file starts, but we don't handle * multi-volume Zip files. */ break; + case 0x000d: + /* PKWARE Unix Extra Field fixed metadata. */ + if (datasize >= 12) { + zip_entry->atime = archive_le32dec(p + offset); + zip_entry->mtime = + archive_le32dec(p + offset + 4); + zip_entry->uid = + archive_le16dec(p + offset + 8); + zip_entry->gid = + archive_le16dec(p + offset + 10); + /* + * APPNOTE.TXT also defines additional data after + * this fixed metadata, depending on file type. + */ + } + break; #ifdef DEBUG case 0x0017: {