Commit: ae769ec0c06225698574da557232d9ee81473c61 Parent: fa66a0fb1e0381d0dc885fb5039a62246688acbd Author: Randy Palamar Date: Sat, 11 Apr 2026 07:29:35 -0600 unzip: import 6.0-29 from oasis Diffstat:
42 files changed, 4171 insertions(+), 0 deletions(-)
diff --git a/dist/.gitignore b/dist/.gitignore @@ -13,3 +13,4 @@ /strace-6.19.tar.xz /sys.tar.gz /transmission-3.00.tar.xz +/unzip60.tar.gz diff --git a/pkg/gen.lua b/pkg/gen.lua @@ -41,6 +41,7 @@ subgen('strace') subgen('the_silver_searcher') subgen('transmission') subgen('u-config') +subgen('unzip') subgen('vis') subgen('zlib') subgen('zstd') diff --git a/pkg/unzip/.gitignore b/pkg/unzip/.gitignore @@ -0,0 +1 @@ +/src diff --git a/pkg/unzip/config.h b/pkg/unzip/config.h @@ -0,0 +1,15 @@ +#define ACORN_FTYPE_NFS +#define DATE_FORMAT DF_YMD +#define IZ_HAVE_UXUIDGID +#define LARGE_FILE_SUPPORT +#define UNICODE_SUPPORT +#define UNICODE_WCHAR +#define UNIX +#define USE_BZIP2 +#define UTF8_MAYBE_NATIVE +#define WILD_STOP_AT_DIR + +/* why does Debian define these? */ +#define NOMEMCPY +#define NO_LCHMOD +#define NO_WORKING_ISPRINT diff --git a/pkg/unzip/gen.lua b/pkg/unzip/gen.lua @@ -0,0 +1,19 @@ +cflags{ + '-include $dir/config.h', + '-I $srcdir', + '-isystem $builddir/pkg/bzip2/include', +} + +pkg.deps = {'pkg/bzip2/headers'} + +exe('unzip', [[ + unzip.c crc32.c crypt.c envargs.c explode.c + extract.c fileio.c globals.c inflate.c list.c match.c + process.c ttyio.c ubz2err.c unreduce.c unshrink.c zipinfo.c + unix/unix.c + $builddir/pkg/bzip2/libbz2.a +]]) +file('bin/unzip', '755', '$outdir/unzip') +man{'man/unzip.1'} + +fetch 'curl' diff --git a/pkg/unzip/patch/0001-In-Debian-manpages-are-in-section-1-not-in-section-1.patch b/pkg/unzip/patch/0001-In-Debian-manpages-are-in-section-1-not-in-section-1.patch @@ -0,0 +1,317 @@ +From 85238f823da4858625f482c696f48e460ba27625 Mon Sep 17 00:00:00 2001 +From: Santiago Vila <sanvila@debian.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] In Debian, manpages are in section 1, not in section 1L + +--- + man/funzip.1 | 8 ++++---- + man/unzip.1 | 24 ++++++++++++------------ + man/unzipsfx.1 | 32 ++++++++++++++++---------------- + man/zipgrep.1 | 8 ++++---- + man/zipinfo.1 | 10 +++++----- + 5 files changed, 41 insertions(+), 41 deletions(-) + +diff --git a/man/funzip.1 b/man/funzip.1 +index 30206e4..a9b4195 100644 +--- a/man/funzip.1 ++++ b/man/funzip.1 +@@ -20,7 +20,7 @@ + .in -4n + .. + .\" ========================================================================= +-.TH FUNZIP 1L "20 April 2009 (v3.95)" "Info-ZIP" ++.TH FUNZIP 1 "20 April 2009 (v3.95)" "Info-ZIP" + .SH NAME + funzip \- filter for extracting from a ZIP archive in a pipe + .PD +@@ -78,7 +78,7 @@ funzip test.zip > /dev/null + .EE + .PP + To use \fIzip\fP and \fIfunzip\fP in place of \fIcompress\fP(1) and +-\fIzcat\fP(1) (or \fIgzip\fP(1L) and \fIgzcat\fP(1L)) for tape backups: ++\fIzcat\fP(1) (or \fIgzip\fP(1) and \fIgzcat\fP(1)) for tape backups: + .PP + .EX + tar cf \- . | zip \-7 | dd of=/dev/nrst0 obs=8k +@@ -108,8 +108,8 @@ itself (future release). + .PD + .\" ========================================================================= + .SH "SEE ALSO" +-\fIgzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L), \fIzip\fP(1L), +-\fIzipcloak\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L) ++\fIgzip\fP(1), \fIunzip\fP(1), \fIunzipsfx\fP(1), \fIzip\fP(1), ++\fIzipcloak\fP(1), \fIzipinfo\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1) + .PD + .\" ========================================================================= + .SH URL +diff --git a/man/unzip.1 b/man/unzip.1 +index 75a7060..eee43a9 100644 +--- a/man/unzip.1 ++++ b/man/unzip.1 +@@ -20,7 +20,7 @@ + .in -4n + .. + .\" ========================================================================= +-.TH UNZIP 1L "20 April 2009 (v6.0)" "Info-ZIP" ++.TH UNZIP 1 "20 April 2009 (v6.0)" "Info-ZIP" + .SH NAME + unzip \- list, test and extract compressed files in a ZIP archive + .PD +@@ -34,7 +34,7 @@ unzip \- list, test and extract compressed files in a ZIP archive + \fIunzip\fP will list, test, or extract files from a ZIP archive, commonly + found on MS-DOS systems. The default behavior (with no options) is to extract + into the current directory (and subdirectories below it) all files from the +-specified ZIP archive. A companion program, \fIzip\fP(1L), creates ZIP ++specified ZIP archive. A companion program, \fIzip\fP(1), creates ZIP + archives; both programs are compatible with archives created by PKWARE's + \fIPKZIP\fP and \fIPKUNZIP\fP for MS-DOS, but in many cases the program + options or default behaviors differ. +@@ -105,8 +105,8 @@ only a reminder of the basic \fIunzip\fP syntax rather than an exhaustive + list of all possible flags. The exhaustive list follows: + .TP + .B \-Z +-\fIzipinfo\fP(1L) mode. If the first option on the command line is \fB\-Z\fP, +-the remaining options are taken to be \fIzipinfo\fP(1L) options. See the ++\fIzipinfo\fP(1) mode. If the first option on the command line is \fB\-Z\fP, ++the remaining options are taken to be \fIzipinfo\fP(1) options. See the + appropriate manual page for a description of these options. + .TP + .B \-A +@@ -178,7 +178,7 @@ encrypted entries from the compressed size numbers. Therefore, + compressed size and compression ratio figures are independent of the entry's + encryption status and show the correct compression performance. (The complete + size of the encrypted compressed data stream for zipfile entries is reported +-by the more verbose \fIzipinfo\fP(1L) reports, see the separate manual.) ++by the more verbose \fIzipinfo\fP(1) reports, see the separate manual.) + When no zipfile is specified (that is, the complete command is simply + ``\fCunzip \-v\fR''), a diagnostic screen is printed. In addition to + the normal header with release date and version, \fIunzip\fP lists the +@@ -379,8 +379,8 @@ file, skip extraction of all existing files, or rename the current file. + .TP + .B \-N + [Amiga] extract file comments as Amiga filenotes. File comments are created +-with the \-c option of \fIzip\fP(1L), or with the \-N option of the Amiga port +-of \fIzip\fP(1L), which stores filenotes as comments. ++with the \-c option of \fIzip\fP(1), or with the \-N option of the Amiga port ++of \fIzip\fP(1), which stores filenotes as comments. + .TP + .B \-o + overwrite existing files without prompting. This is a dangerous option, so +@@ -598,7 +598,7 @@ Unix \fInice\fP(1). + As suggested by the examples above, the default variable names are UNZIP_OPTS + for VMS (where the symbol used to install \fIunzip\fP as a foreign command + would otherwise be confused with the environment variable), and UNZIP +-for all other operating systems. For compatibility with \fIzip\fP(1L), ++for all other operating systems. For compatibility with \fIzip\fP(1), + UNZIPOPT is also accepted (don't ask). If both UNZIP and UNZIPOPT + are defined, however, UNZIP takes precedence. \fIunzip\fP's diagnostic + option (\fB\-v\fP with no zipfile name) can be used to check the values +@@ -648,8 +648,8 @@ prompt for another password, and so on until all files are extracted. If + a password is not known, entering a null password (that is, just a carriage + return or ``Enter'') is taken as a signal to skip all further prompting. + Only unencrypted files in the archive(s) will thereafter be extracted. (In +-fact, that's not quite true; older versions of \fIzip\fP(1L) and +-\fIzipcloak\fP(1L) allowed null passwords, so \fIunzip\fP checks each encrypted ++fact, that's not quite true; older versions of \fIzip\fP(1) and ++\fIzipcloak\fP(1) allowed null passwords, so \fIunzip\fP checks each encrypted + file to see if the null password works. This may result in ``false positives'' + and extraction errors, as noted above.) + .PP +@@ -943,8 +943,8 @@ deleted. + .PD + .\" ========================================================================= + .SH "SEE ALSO" +-\fIfunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipgrep\fP(1L), +-\fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L) ++\fIfunzip\fP(1), \fIzip\fP(1), \fIzipcloak\fP(1), \fIzipgrep\fP(1), ++\fIzipinfo\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1) + .PD + .\" ========================================================================= + .SH URL +diff --git a/man/unzipsfx.1 b/man/unzipsfx.1 +index d9a0e59..533711f 100644 +--- a/man/unzipsfx.1 ++++ b/man/unzipsfx.1 +@@ -20,7 +20,7 @@ + .in -4n + .. + .\" ========================================================================= +-.TH UNZIPSFX 1L "20 April 2009 (v6.0)" "Info-ZIP" ++.TH UNZIPSFX 1 "20 April 2009 (v6.0)" "Info-ZIP" + .SH NAME + unzipsfx \- self-extracting stub for prepending to ZIP archives + .PD +@@ -30,7 +30,7 @@ unzipsfx \- self-extracting stub for prepending to ZIP archives + .PD + .\" ========================================================================= + .SH DESCRIPTION +-\fIunzipsfx\fP is a modified version of \fIunzip\fP(1L) designed to be ++\fIunzipsfx\fP is a modified version of \fIunzip\fP(1) designed to be + prepended to existing ZIP archives in order to form self-extracting archives. + Instead of taking its first non-flag argument to be the zipfile(s) to be + extracted, \fIunzipsfx\fP seeks itself under the name by which it was invoked +@@ -109,7 +109,7 @@ literal subdirectory ``\fB~\fP'' of the current directory. + .PD + .\" ========================================================================= + .SH OPTIONS +-\fIunzipsfx\fP supports the following \fIunzip\fP(1L) options: \fB\-c\fP ++\fIunzipsfx\fP supports the following \fIunzip\fP(1) options: \fB\-c\fP + and \fB\-p\fP (extract to standard output/screen), \fB\-f\fP and \fB\-u\fP + (freshen and update existing files upon extraction), \fB\-t\fP (test + archive) and \fB\-z\fP (print archive comment). All normal listing options +@@ -118,11 +118,11 @@ option (\fB\-t\fP) may be used as a ``poor man's'' listing. Alternatively, + those creating self-extracting archives may wish to include a short listing + in the zipfile comment. + .PP +-See \fIunzip\fP(1L) for a more complete description of these options. ++See \fIunzip\fP(1) for a more complete description of these options. + .PD + .\" ========================================================================= + .SH MODIFIERS +-\fIunzipsfx\fP currently supports all \fIunzip\fP(1L) modifiers: \fB\-a\fP ++\fIunzipsfx\fP currently supports all \fIunzip\fP(1) modifiers: \fB\-a\fP + (convert text files), \fB\-n\fP (never overwrite), \fB\-o\fP (overwrite + without prompting), \fB\-q\fP (operate quietly), \fB\-C\fP (match names + case-insensitively), \fB\-L\fP (convert uppercase-OS names to lowercase), +@@ -137,18 +137,18 @@ files have the appropriate format for the local OS. EBCDIC conversion will + of course continue to be supported since the zipfile format implies ASCII + storage of text files.) + .PP +-See \fIunzip\fP(1L) for a more complete description of these modifiers. ++See \fIunzip\fP(1) for a more complete description of these modifiers. + .PD + .\" ========================================================================= + .SH "ENVIRONMENT OPTIONS" +-\fIunzipsfx\fP uses the same environment variables as \fIunzip\fP(1L) does, ++\fIunzipsfx\fP uses the same environment variables as \fIunzip\fP(1) does, + although this is likely to be an issue only for the person creating and +-testing the self-extracting archive. See \fIunzip\fP(1L) for details. ++testing the self-extracting archive. See \fIunzip\fP(1) for details. + .PD + .\" ========================================================================= + .SH DECRYPTION +-Decryption is supported exactly as in \fIunzip\fP(1L); that is, interactively +-with a non-echoing prompt for the password(s). See \fIunzip\fP(1L) for ++Decryption is supported exactly as in \fIunzip\fP(1); that is, interactively ++with a non-echoing prompt for the password(s). See \fIunzip\fP(1) for + details. Once again, note that if the archive has no encrypted files there + is no reason to use a version of \fIunzipsfx\fP with decryption support; + that only adds to the size of the archive. +@@ -286,7 +286,7 @@ available that provide the full path name, so the archive may be invoked + from anywhere in the user's path. The situation is not known for AmigaDOS, + Atari TOS, MacOS, etc. + .PP +-As noted above, a number of the normal \fIunzip\fP(1L) functions have ++As noted above, a number of the normal \fIunzip\fP(1) functions have + been removed in order to make \fIunzipsfx\fP smaller: usage and diagnostic + info, listing functions and extraction to other directories. Also, only + stored and deflated files are supported. The latter limitation is mainly +@@ -303,17 +303,17 @@ does not work. (For technically oriented users, the attached archive is + defined as a ``debug hunk.'') There may be compatibility problems between + the ROM levels of older Amigas and newer ones. + .PP +-All current bugs in \fIunzip\fP(1L) exist in \fIunzipsfx\fP as well. ++All current bugs in \fIunzip\fP(1) exist in \fIunzipsfx\fP as well. + .PD + .\" ========================================================================= + .SH DIAGNOSTICS + \fIunzipsfx\fP's exit status (error level) is identical to that of +-\fIunzip\fP(1L); see the corresponding man page. ++\fIunzip\fP(1); see the corresponding man page. + .PD + .\" ========================================================================= + .SH "SEE ALSO" +-\fIfunzip\fP(1L), \fIunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L), +-\fIzipgrep\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L) ++\fIfunzip\fP(1), \fIunzip\fP(1), \fIzip\fP(1), \fIzipcloak\fP(1), ++\fIzipgrep\fP(1), \fIzipinfo\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1) + .PD + .PD + .\" ========================================================================= +@@ -330,7 +330,7 @@ or + .\" ========================================================================= + .SH AUTHORS + Greg Roelofs was responsible for the basic modifications to UnZip necessary +-to create UnZipSFX. See \fIunzip\fP(1L) for the current list of Zip-Bugs ++to create UnZipSFX. See \fIunzip\fP(1) for the current list of Zip-Bugs + authors, or the file CONTRIBS in the UnZip source distribution for the + full list of Info-ZIP contributors. + .PD +diff --git a/man/zipgrep.1 b/man/zipgrep.1 +index dad83f8..252fcae 100644 +--- a/man/zipgrep.1 ++++ b/man/zipgrep.1 +@@ -8,7 +8,7 @@ + .\" zipgrep.1 by Greg Roelofs. + .\" + .\" ========================================================================= +-.TH ZIPGREP 1L "20 April 2009" "Info-ZIP" ++.TH ZIPGREP 1 "20 April 2009" "Info-ZIP" + .SH NAME + zipgrep \- search files in a ZIP archive for lines matching a pattern + .PD +@@ -21,7 +21,7 @@ zipgrep \- search files in a ZIP archive for lines matching a pattern + .SH DESCRIPTION + \fIzipgrep\fP will search files within a ZIP archive for lines matching + the given string or pattern. \fIzipgrep\fP is a shell script and requires +-\fIegrep\fP(1) and \fIunzip\fP(1L) to function. Its output is identical to ++\fIegrep\fP(1) and \fIunzip\fP(1) to function. Its output is identical to + that of \fIegrep\fP(1). + .PD + .\" ========================================================================= +@@ -69,8 +69,8 @@ All options prior to the ZIP archive filename are passed to \fIegrep\fP(1). + .PD + .\" ========================================================================= + .SH "SEE ALSO" +-\fIegrep\fP(1), \fIunzip\fP(1L), \fIzip\fP(1L), \fIfunzip\fP(1L), +-\fIzipcloak\fP(1L), \fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L) ++\fIegrep\fP(1), \fIunzip\fP(1), \fIzip\fP(1), \fIfunzip\fP(1), ++\fIzipcloak\fP(1), \fIzipinfo\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1) + .PD + .\" ========================================================================= + .SH URL +diff --git a/man/zipinfo.1 b/man/zipinfo.1 +index 428e4b9..22d1fa2 100644 +--- a/man/zipinfo.1 ++++ b/man/zipinfo.1 +@@ -34,7 +34,7 @@ + .in -4n + .. + .\" ========================================================================= +-.TH ZIPINFO 1L "20 April 2009 (v3.0)" "Info-ZIP" ++.TH ZIPINFO 1 "20 April 2009 (v3.0)" "Info-ZIP" + .SH NAME + zipinfo \- list detailed information about a ZIP archive + .PD +@@ -272,7 +272,7 @@ format: + Note that because of limitations in the MS-DOS format used to store file + times, the seconds field is always rounded to the nearest even second. + For Unix files this is expected to change in the next major releases of +-\fIzip\fP(1L) and \fIunzip\fP. ++\fIzip\fP(1) and \fIunzip\fP. + .PP + In addition to individual file information, a default zipfile listing + also includes header and trailer lines: +@@ -361,7 +361,7 @@ of the Unix command \fInice\fP(1). + As suggested above, the default variable names are ZIPINFO_OPTS for VMS + (where the symbol used to install \fIzipinfo\fP as a foreign command + would otherwise be confused with the environment variable), and ZIPINFO +-for all other operating systems. For compatibility with \fIzip\fP(1L), ++for all other operating systems. For compatibility with \fIzip\fP(1), + ZIPINFOOPT is also accepted (don't ask). If both ZIPINFO and ZIPINFOOPT + are defined, however, ZIPINFO takes precedence. \fIunzip\fP's diagnostic + option (\fB\-v\fP with no zipfile name) can be used to check the values +@@ -496,8 +496,8 @@ be simplified. (This is not to say that it will be.) + .PP + .\" ========================================================================= + .SH "SEE ALSO" +-\fIls\fP(1), \fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L), +-\fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L) ++\fIls\fP(1), \fIfunzip\fP(1), \fIunzip\fP(1), \fIunzipsfx\fP(1), ++\fIzip\fP(1), \fIzipcloak\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1) + .PD + .\" ========================================================================= + .SH URL +-- +2.20.1 + diff --git a/pkg/unzip/patch/0002-Branding-patch-UnZip-by-Debian.-Original-by-Info-ZIP.patch b/pkg/unzip/patch/0002-Branding-patch-UnZip-by-Debian.-Original-by-Info-ZIP.patch @@ -0,0 +1,26 @@ +From 2561e7b7057dcca65b1ff2d5d2e12b4a1ba254fe Mon Sep 17 00:00:00 2001 +From: Santiago Vila <sanvila@debian.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] "Branding patch": UnZip by Debian. Original by Info-ZIP. + +--- + unzip.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/unzip.c b/unzip.c +index 8dbfc95..1abaccb 100644 +--- a/unzip.c ++++ b/unzip.c +@@ -570,8 +570,7 @@ Send bug reports using //www.info-zip.org/zip-bug.html; see README for details.\ + #else /* !VMS */ + # ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1[] = "\ +-UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +-bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\ ++UnZip %d.%d%d%s of %s, by Debian. Original by Info-ZIP.\ + \n\n"; + # else + static ZCONST char Far UnzipUsageLine1[] = "\ +-- +2.20.1 + diff --git a/pkg/unzip/patch/0003-include-unistd.h-for-kFreeBSD.patch b/pkg/unzip/patch/0003-include-unistd.h-for-kFreeBSD.patch @@ -0,0 +1,24 @@ +From d27f3482cf46603d05d46bbc290ce6bb0f7ff210 Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno <aurel32@debian.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] #include <unistd.h> for kFreeBSD + +--- + unix/unxcfg.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/unix/unxcfg.h b/unix/unxcfg.h +index e39b283..c98c3b9 100644 +--- a/unix/unxcfg.h ++++ b/unix/unxcfg.h +@@ -52,6 +52,7 @@ + + #include <sys/types.h> /* off_t, time_t, dev_t, ... */ + #include <sys/stat.h> ++#include <unistd.h> + + #ifdef NO_OFF_T + typedef long zoff_t; +-- +2.20.1 + diff --git a/pkg/unzip/patch/0004-Handle-the-PKWare-verification-bit-of-internal-attri.patch b/pkg/unzip/patch/0004-Handle-the-PKWare-verification-bit-of-internal-attri.patch @@ -0,0 +1,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 + diff --git a/pkg/unzip/patch/0005-Restore-uid-and-gid-information-when-requested.patch b/pkg/unzip/patch/0005-Restore-uid-and-gid-information-when-requested.patch @@ -0,0 +1,38 @@ +From 8e82b2116b190c9dd4ef2b56e1282ca2c6e30b62 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] Restore uid and gid information when requested + +--- + process.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/process.c b/process.c +index ed314e1..df58d28 100644 +--- a/process.c ++++ b/process.c +@@ -2904,7 +2904,7 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + #ifdef IZ_HAVE_UXUIDGID + if (eb_len >= EB_UX3_MINLEN + && z_uidgid != NULL +- && (*((EB_HEADSIZE + 0) + ef_buf) == 1) ++ && (*((EB_HEADSIZE + 0) + ef_buf) == 1)) + /* only know about version 1 */ + { + uch uid_size; +@@ -2916,10 +2916,10 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + flags &= ~0x0ff; /* ignore any previous UNIX field */ + + if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf, +- uid_size, z_uidgid[0]) ++ uid_size, &z_uidgid[0]) + && + read_ux3_value((EB_HEADSIZE + uid_size + 3) + ef_buf, +- gid_size, z_uidgid[1]) ) ++ gid_size, &z_uidgid[1]) ) + { + flags |= EB_UX2_VALID; /* signal success */ + } +-- +2.20.1 + diff --git a/pkg/unzip/patch/0006-Initialize-the-symlink-flag.patch b/pkg/unzip/patch/0006-Initialize-the-symlink-flag.patch @@ -0,0 +1,29 @@ +From d160eb934654c2a52ef7f8273a7f651fd6178b7d Mon Sep 17 00:00:00 2001 +From: Andreas Schwab <schwab@linux-m68k.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] Initialize the symlink flag + +--- + process.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/process.c b/process.c +index df58d28..3228bde 100644 +--- a/process.c ++++ b/process.c +@@ -1758,6 +1758,12 @@ int process_cdir_file_hdr(__G) /* return PK-type error code */ + = (G.crec.general_purpose_bit_flag & (1 << 11)) == (1 << 11); + #endif + ++#ifdef SYMLINKS ++ /* Initialize the symlink flag, may be set by the platform-specific ++ mapattr function. */ ++ G.pInfo->symlink = 0; ++#endif ++ + return PK_COOL; + + } /* end function process_cdir_file_hdr() */ +-- +2.20.1 + diff --git a/pkg/unzip/patch/0007-Increase-size-of-cfactorstr-array-to-avoid-buffer-ov.patch b/pkg/unzip/patch/0007-Increase-size-of-cfactorstr-array-to-avoid-buffer-ov.patch @@ -0,0 +1,25 @@ +From 5ba63850818457aa3147ab40adc376ff7dc0f1c9 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] Increase size of cfactorstr array to avoid buffer overflow + +--- + list.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/list.c b/list.c +index 15e0011..5de41e5 100644 +--- a/list.c ++++ b/list.c +@@ -97,7 +97,7 @@ int list_files(__G) /* return PK-type error code */ + { + int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL; + #ifndef WINDLL +- char sgn, cfactorstr[10]; ++ char sgn, cfactorstr[12]; + int longhdr=(uO.vflag>1); + #endif + int date_format; +-- +2.20.1 + diff --git a/pkg/unzip/patch/0008-zipinfo.c-Do-not-crash-when-hostver-byte-is-100.patch b/pkg/unzip/patch/0008-zipinfo.c-Do-not-crash-when-hostver-byte-is-100.patch @@ -0,0 +1,25 @@ +From 4d3698e4c587e5071ebedaa12daa8e86e2fcffc2 Mon Sep 17 00:00:00 2001 +From: Santiago Vila <sanvila@debian.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] zipinfo.c: Do not crash when hostver byte is >= 100 + +--- + zipinfo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zipinfo.c b/zipinfo.c +index a92bca9..5e77018 100644 +--- a/zipinfo.c ++++ b/zipinfo.c +@@ -2114,7 +2114,7 @@ static int zi_short(__G) /* return PK-type error code */ + else + attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T==undefined */ + +- sprintf(&attribs[12], "%u.%u", hostver/10, hostver%10); ++ sprintf(&attribs[11], "%2u.%u", hostver/10, hostver%10); + break; + + } /* end switch (hostnum: external attributes format) */ +-- +2.20.1 + diff --git a/pkg/unzip/patch/0009-Fix-CVE-2014-8139-CRC32-verification-heap-based-over.patch b/pkg/unzip/patch/0009-Fix-CVE-2014-8139-CRC32-verification-heap-based-over.patch @@ -0,0 +1,63 @@ +From 9decdbe830f233fad7428df99e0c2d34887ac3cf 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] Fix CVE-2014-8139: CRC32 verification heap-based overflow + +--- + extract.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/extract.c b/extract.c +index 1acd769..df0fa1c 100644 +--- a/extract.c ++++ b/extract.c +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -298,6 +298,8 @@ char ZCONST Far TruncNTSD[] = + #ifndef SFX + static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \ + EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n"; ++ static ZCONST char Far TooSmallEBlength[] = "bad extra-field entry:\n \ ++ EF block length (%u bytes) invalid (< %d)\n"; + static ZCONST char Far InvalidComprDataEAs[] = + " invalid compressed data for EAs\n"; + # if (defined(WIN32) && defined(NTSD_EAS)) +@@ -2023,7 +2025,8 @@ static int TestExtraField(__G__ ef, ef_len) + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + +- if (ebLen > (ef_len - EB_HEADSIZE)) { ++ if (ebLen > (ef_len - EB_HEADSIZE)) ++ { + /* Discovered some extra field inconsistency! */ + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", +@@ -2158,11 +2161,19 @@ static int TestExtraField(__G__ ef, ef_len) + } + break; + case EF_PKVMS: +- if (makelong(ef+EB_HEADSIZE) != ++ if (ebLen < 4) ++ { ++ Info(slide, 1, ++ ((char *)slide, LoadFarString(TooSmallEBlength), ++ ebLen, 4)); ++ } ++ else if (makelong(ef+EB_HEADSIZE) != + crc32(CRCVAL_INITIAL, ef+(EB_HEADSIZE+4), + (extent)(ebLen-4))) ++ { + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); ++ } + break; + case EF_PKW32: + case EF_PKUNIX: +-- +2.20.1 + diff --git a/pkg/unzip/patch/0010-Fix-CVE-2014-8140-out-of-bounds-write-issue-in-test_.patch b/pkg/unzip/patch/0010-Fix-CVE-2014-8140-out-of-bounds-write-issue-in-test_.patch @@ -0,0 +1,38 @@ +From a8ce86155076505d0d6e3d8a3e44c26bb89d9524 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] Fix CVE-2014-8140: out-of-bounds write issue in + test_compr_eb() + +--- + extract.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/extract.c b/extract.c +index df0fa1c..ec31e60 100644 +--- a/extract.c ++++ b/extract.c +@@ -2232,10 +2232,17 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ + ++ /* Return no/bad-data error status if any problem is found: ++ * 1. eb_size is too small to hold the uncompressed size ++ * (eb_ucsize). (Else extract eb_ucsize.) ++ * 2. eb_ucsize is zero (invalid). 2014-12-04 SMS. ++ * 3. eb_ucsize is positive, but eb_size is too small to hold ++ * the compressed data header. ++ */ + if ((eb_size < (EB_UCSIZE_P + 4)) || +- ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && +- eb_size <= (compr_offset + EB_CMPRHEADLEN))) +- return IZ_EF_TRUNC; /* no compressed data! */ ++ ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) || ++ ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) ++ return IZ_EF_TRUNC; /* no/bad compressed data! */ + + if ( + #ifdef INT_16BIT +-- +2.20.1 + diff --git a/pkg/unzip/patch/0011-Fix-CVE-2014-8141-out-of-bounds-read-issues-in-getZi.patch b/pkg/unzip/patch/0011-Fix-CVE-2014-8141-out-of-bounds-read-issues-in-getZi.patch @@ -0,0 +1,151 @@ +From 0bec3de89a03c7c998b755ff6091ab1e0f6c43b7 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] Fix CVE-2014-8141: out-of-bounds read issues in + getZip64Data() + +--- + fileio.c | 9 +++++++- + process.c | 68 +++++++++++++++++++++++++++++++++++++++++-------------- + 2 files changed, 59 insertions(+), 18 deletions(-) + +diff --git a/fileio.c b/fileio.c +index ba0a1d0..36bfea3 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -176,6 +176,8 @@ static ZCONST char Far FilenameTooLongTrunc[] = + #endif + static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; ++static ZCONST char Far ExtraFieldCorrupt[] = ++ "warning: extra field (type: 0x%04x) corrupt. Continuing...\n"; + + #ifdef WINDLL + static ZCONST char Far DiskFullQuery[] = +@@ -2295,7 +2297,12 @@ int do_string(__G__ length, option) /* return PK-type error code */ + if (readbuf(__G__ (char *)G.extra_field, length) == 0) + return PK_EOF; + /* Looks like here is where extra fields are read */ +- getZip64Data(__G__ G.extra_field, length); ++ if (getZip64Data(__G__ G.extra_field, length) != PK_COOL) ++ { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString( ExtraFieldCorrupt), EF_PKSZ64)); ++ error = PK_WARN; ++ } + #ifdef UNICODE_SUPPORT + G.unipath_filename = NULL; + if (G.UzO.U_flag < 2) { +diff --git a/process.c b/process.c +index 3228bde..df683ea 100644 +--- a/process.c ++++ b/process.c +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 1990-2009 Info-ZIP. All rights reserved. ++ Copyright (c) 1990-2014 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2009-Jan-02 or later + (the contents of which are also included in unzip.h) for terms of use. +@@ -1901,48 +1901,82 @@ int getZip64Data(__G__ ef_buf, ef_len) + and a 4-byte version of disk start number. + Sets both local header and central header fields. Not terribly clever, + but it means that this procedure is only called in one place. ++ ++ 2014-12-05 SMS. ++ Added checks to ensure that enough data are available before calling ++ makeint64() or makelong(). Replaced various sizeof() values with ++ simple ("4" or "8") constants. (The Zip64 structures do not depend ++ on our variable sizes.) Error handling is crude, but we should now ++ stay within the buffer. + ---------------------------------------------------------------------------*/ + ++#define Z64FLGS 0xffff ++#define Z64FLGL 0xffffffff ++ + if (ef_len == 0 || ef_buf == NULL) + return PK_COOL; + + Trace((stderr,"\ngetZip64Data: scanning extra field of length %u\n", + ef_len)); + +- while (ef_len >= EB_HEADSIZE) { ++ while (ef_len >= EB_HEADSIZE) ++ { + eb_id = makeword(EB_ID + ef_buf); + eb_len = makeword(EB_LEN + ef_buf); + +- if (eb_len > (ef_len - EB_HEADSIZE)) { +- /* discovered some extra field inconsistency! */ ++ if (eb_len > (ef_len - EB_HEADSIZE)) ++ { ++ /* Extra block length exceeds remaining extra field length. */ + Trace((stderr, + "getZip64Data: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } +- if (eb_id == EF_PKSZ64) { +- ++ if (eb_id == EF_PKSZ64) ++ { + int offset = EB_HEADSIZE; + +- if (G.crec.ucsize == 0xffffffff || G.lrec.ucsize == 0xffffffff){ +- G.lrec.ucsize = G.crec.ucsize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.ucsize); ++ if ((G.crec.ucsize == Z64FLGL) || (G.lrec.ucsize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.crec.ucsize = G.lrec.ucsize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.csize == 0xffffffff || G.lrec.csize == 0xffffffff){ +- G.csize = G.lrec.csize = G.crec.csize = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.csize); ++ ++ if ((G.crec.csize == Z64FLGL) || (G.lrec.csize == Z64FLGL)) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ ++ G.csize = G.crec.csize = G.lrec.csize = makeint64(offset + ef_buf); ++ offset += 8; + } +- if (G.crec.relative_offset_local_header == 0xffffffff){ ++ ++ if (G.crec.relative_offset_local_header == Z64FLGL) ++ { ++ if (offset+ 8 > ef_len) ++ return PK_ERR; ++ + G.crec.relative_offset_local_header = makeint64(offset + ef_buf); +- offset += sizeof(G.crec.relative_offset_local_header); ++ offset += 8; + } +- if (G.crec.disk_number_start == 0xffff){ ++ ++ if (G.crec.disk_number_start == Z64FLGS) ++ { ++ if (offset+ 4 > ef_len) ++ return PK_ERR; ++ + G.crec.disk_number_start = (zuvl_t)makelong(offset + ef_buf); +- offset += sizeof(G.crec.disk_number_start); ++ offset += 4; + } ++#if 0 ++ break; /* Expect only one EF_PKSZ64 block. */ ++#endif /* 0 */ + } + +- /* Skip this extra field block */ ++ /* Skip this extra field block. */ + ef_buf += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } +-- +2.20.1 + diff --git a/pkg/unzip/patch/0012-Info-ZIP-UnZip-buffer-overflow.patch b/pkg/unzip/patch/0012-Info-ZIP-UnZip-buffer-overflow.patch @@ -0,0 +1,48 @@ +From 14342a8a5ddafa76a8aa9800da078d415f50af71 Mon Sep 17 00:00:00 2001 +From: mancha <mancha1@zoho.com> +Date: Wed, 11 Feb 2015 12:27:06 +0000 +Subject: [PATCH] Info-ZIP UnZip buffer overflow + +By carefully crafting a corrupt ZIP archive with "extra fields" that +purport to have compressed blocks larger than the corresponding +uncompressed blocks in STORED no-compression mode, an attacker can +trigger a heap overflow that can result in application crash or +possibly have other unspecified impact. + +This patch ensures that when extra fields use STORED mode, the +"compressed" and uncompressed block sizes match. +--- + extract.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/extract.c b/extract.c +index ec31e60..f951b9f 100644 +--- a/extract.c ++++ b/extract.c +@@ -2228,6 +2228,7 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + ulg eb_ucsize; + uch *eb_ucptr; + int r; ++ ush eb_compr_method; + + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ +@@ -2244,6 +2245,15 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN)))) + return IZ_EF_TRUNC; /* no/bad compressed data! */ + ++ /* 2015-02-10 Mancha(?), Michal Zalewski, Tomas Hoger, SMS. ++ * For STORE method, compressed and uncompressed sizes must agree. ++ * http://www.info-zip.org/phpBB3/viewtopic.php?f=7&t=450 ++ */ ++ eb_compr_method = makeword( eb + (EB_HEADSIZE + compr_offset)); ++ if ((eb_compr_method == STORED) && ++ (eb_size != compr_offset + EB_CMPRHEADLEN + eb_ucsize)) ++ return PK_ERR; ++ + if ( + #ifdef INT_16BIT + (((ulg)(extent)eb_ucsize) != eb_ucsize) || +-- +2.20.1 + diff --git a/pkg/unzip/patch/0013-Remove-build-date.patch b/pkg/unzip/patch/0013-Remove-build-date.patch @@ -0,0 +1,25 @@ +From f6fa609c9074df6df59023e032f5397c44b40e8d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lunar@debian.org> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] Remove build date + +--- + unix/unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/unix/unix.c b/unix/unix.c +index efa97fc..816e3da 100644 +--- a/unix/unix.c ++++ b/unix/unix.c +@@ -1705,7 +1705,7 @@ void version(__G) + #endif /* Sun */ + #endif /* SGI */ + +-#ifdef __DATE__ ++#if 0 + " on ", __DATE__ + #else + "", "" +-- +2.20.1 + diff --git a/pkg/unzip/patch/0014-Upstream-fix-for-heap-overflow.patch b/pkg/unzip/patch/0014-Upstream-fix-for-heap-overflow.patch @@ -0,0 +1,35 @@ +From d97748a061a3beb8bdf4d5d0a2458086951960ff Mon Sep 17 00:00:00 2001 +From: Petr Stodulka <pstodulk@redhat.com> +Date: Mon, 14 Sep 2015 18:23:17 +0200 +Subject: [PATCH] Upstream fix for heap overflow + +--- + crypt.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/crypt.c b/crypt.c +index 784e411..a8975f2 100644 +--- a/crypt.c ++++ b/crypt.c +@@ -465,7 +465,17 @@ int decrypt(__G__ passwrd) + GLOBAL(pInfo->encrypted) = FALSE; + defer_leftover_input(__G); + for (n = 0; n < RAND_HEAD_LEN; n++) { +- b = NEXTBYTE; ++ /* 2012-11-23 SMS. (OUSPG report.) ++ * Quit early if compressed size < HEAD_LEN. The resulting ++ * error message ("unable to get password") could be improved, ++ * but it's better than trying to read nonexistent data, and ++ * then continuing with a negative G.csize. (See ++ * fileio.c:readbyte()). ++ */ ++ if ((b = NEXTBYTE) == (ush)EOF) ++ { ++ return PK_ERR; ++ } + h[n] = (uch)b; + Trace((stdout, " (%02x)", h[n])); + } +-- +2.20.1 + diff --git a/pkg/unzip/patch/0015-fix-infinite-loop-when-extracting-empty-bzip2-data.patch b/pkg/unzip/patch/0015-fix-infinite-loop-when-extracting-empty-bzip2-data.patch @@ -0,0 +1,29 @@ +From e646271050da793fe50fe829b465c4e692fb7d53 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka <kdudka@redhat.com> +Date: Mon, 14 Sep 2015 18:24:56 +0200 +Subject: [PATCH] fix infinite loop when extracting empty bzip2 data + +--- + extract.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/extract.c b/extract.c +index f951b9f..188f1cf 100644 +--- a/extract.c ++++ b/extract.c +@@ -2729,6 +2729,12 @@ __GDEF + int repeated_buf_err; + bz_stream bstrm; + ++ if (G.incnt <= 0 && G.csize <= 0L) { ++ /* avoid an infinite loop */ ++ Trace((stderr, "UZbunzip2() got empty input\n")); ++ return 2; ++ } ++ + #if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; +-- +2.20.1 + diff --git a/pkg/unzip/patch/0016-extract-prevent-unsigned-overflow-on-invalid-input.patch b/pkg/unzip/patch/0016-extract-prevent-unsigned-overflow-on-invalid-input.patch @@ -0,0 +1,36 @@ +From c2b00ce1582efdb781355dfa7b161b5393cfa56f Mon Sep 17 00:00:00 2001 +From: Kamil Dudka <kdudka@redhat.com> +Date: Tue, 22 Sep 2015 18:52:23 +0200 +Subject: [PATCH] extract: prevent unsigned overflow on invalid input + +Suggested-by: Stefan Cornelius +--- + extract.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/extract.c b/extract.c +index 188f1cf..549a5eb 100644 +--- a/extract.c ++++ b/extract.c +@@ -1257,8 +1257,17 @@ static int extract_or_test_entrylist(__G__ numchunk, + if (G.lrec.compression_method == STORED) { + zusz_t csiz_decrypted = G.lrec.csize; + +- if (G.pInfo->encrypted) ++ if (G.pInfo->encrypted) { ++ if (csiz_decrypted < 12) { ++ /* handle the error now to prevent unsigned overflow */ ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarStringSmall(ErrUnzipNoFile), ++ LoadFarString(InvalidComprData), ++ LoadFarStringSmall2(Inflate))); ++ return PK_ERR; ++ } + csiz_decrypted -= 12; ++ } + if (G.lrec.ucsize != csiz_decrypted) { + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall2(WrnStorUCSizCSizDiff), +-- +2.20.1 + diff --git a/pkg/unzip/patch/0017-Do-not-ignore-extra-fields-containing-Unix-Timestamp.patch b/pkg/unzip/patch/0017-Do-not-ignore-extra-fields-containing-Unix-Timestamp.patch @@ -0,0 +1,50 @@ +From 528161b86e74c3afbe640c70761e6734119bea1c 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] Do not ignore extra fields containing Unix Timestamps + +--- + process.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/process.c b/process.c +index df683ea..e4f2405 100644 +--- a/process.c ++++ b/process.c +@@ -2914,10 +2914,13 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + break; + + case EF_IZUNIX2: +- if (have_new_type_eb == 0) { +- flags &= ~0x0ff; /* ignore any previous IZUNIX field */ ++ if (have_new_type_eb == 0) { /* (< 1) */ + have_new_type_eb = 1; + } ++ if (have_new_type_eb <= 1) { ++ /* Ignore any prior (EF_IZUNIX/EF_PKUNIX) UID/GID. */ ++ flags &= 0x0ff; ++ } + #ifdef IZ_HAVE_UXUIDGID + if (have_new_type_eb > 1) + break; /* IZUNIX3 overrides IZUNIX2 e.f. block ! */ +@@ -2933,6 +2936,8 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + /* new 3rd generation Unix ef */ + have_new_type_eb = 2; + ++ /* Ignore any prior EF_IZUNIX/EF_PKUNIX/EF_IZUNIX2 UID/GID. */ ++ flags &= 0x0ff; + /* + Version 1 byte version of this extra field, currently 1 + UIDSize 1 byte Size of UID field +@@ -2953,8 +2958,6 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + uid_size = *((EB_HEADSIZE + 1) + ef_buf); + gid_size = *((EB_HEADSIZE + uid_size + 2) + ef_buf); + +- flags &= ~0x0ff; /* ignore any previous UNIX field */ +- + if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf, + uid_size, &z_uidgid[0]) + && +-- +2.20.1 + diff --git a/pkg/unzip/patch/0018-Fix-CVE-2014-9913-buffer-overflow-in-unzip.patch b/pkg/unzip/patch/0018-Fix-CVE-2014-9913-buffer-overflow-in-unzip.patch @@ -0,0 +1,36 @@ +From 27b0cd89656d39266da7dcab7eb1812dcfc34192 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] Fix CVE-2014-9913, buffer overflow in unzip + +--- + list.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/list.c b/list.c +index 5de41e5..e488109 100644 +--- a/list.c ++++ b/list.c +@@ -339,7 +339,18 @@ int list_files(__G) /* return PK-type error code */ + G.crec.compression_method == ENHDEFLATED) { + methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3]; + } else if (methnum >= NUM_METHODS) { +- sprintf(&methbuf[4], "%03u", G.crec.compression_method); ++ /* 2013-02-26 SMS. ++ * http://sourceforge.net/p/infozip/bugs/27/ CVE-2014-9913. ++ * Unexpectedly large compression methods overflow ++ * &methbuf[]. Use the old, three-digit decimal format ++ * for values which fit. Otherwise, sacrifice the ++ * colon, and use four-digit hexadecimal. ++ */ ++ if (G.crec.compression_method <= 999) { ++ sprintf( &methbuf[ 4], "%03u", G.crec.compression_method); ++ } else { ++ sprintf( &methbuf[ 3], "%04X", G.crec.compression_method); ++ } + } + + #if 0 /* GRR/Euro: add this? */ +-- +2.20.1 + diff --git a/pkg/unzip/patch/0019-Fix-CVE-2016-9844-buffer-overflow-in-zipinfo.patch b/pkg/unzip/patch/0019-Fix-CVE-2016-9844-buffer-overflow-in-zipinfo.patch @@ -0,0 +1,36 @@ +From 7e0435546230ecebe3bfe1ac27eb0186c702c509 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] Fix CVE-2016-9844, buffer overflow in zipinfo + +--- + zipinfo.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/zipinfo.c b/zipinfo.c +index 5e77018..0be3e5b 100644 +--- a/zipinfo.c ++++ b/zipinfo.c +@@ -1921,7 +1921,18 @@ static int zi_short(__G) /* return PK-type error code */ + ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3); + methbuf[3] = dtype[dnum]; + } else if (methnum >= NUM_METHODS) { /* unknown */ +- sprintf(&methbuf[1], "%03u", G.crec.compression_method); ++ /* 2016-12-05 SMS. ++ * https://launchpad.net/bugs/1643750 ++ * Unexpectedly large compression methods overflow ++ * &methbuf[]. Use the old, three-digit decimal format ++ * for values which fit. Otherwise, sacrifice the "u", ++ * and use four-digit hexadecimal. ++ */ ++ if (G.crec.compression_method <= 999) { ++ sprintf( &methbuf[ 1], "%03u", G.crec.compression_method); ++ } else { ++ sprintf( &methbuf[ 0], "%04X", G.crec.compression_method); ++ } + } + + for (k = 0; k < 15; ++k) +-- +2.20.1 + diff --git a/pkg/unzip/patch/0020-Fix-buffer-overflow-in-password-protected-zip-archiv.patch b/pkg/unzip/patch/0020-Fix-buffer-overflow-in-password-protected-zip-archiv.patch @@ -0,0 +1,44 @@ +From d8d3475850d883e90d79086293279149d42658fd Mon Sep 17 00:00:00 2001 +From: Karol Babioch <kbabioch@suse.com> +Date: Sat, 15 Jun 2019 18:13:11 -0700 +Subject: [PATCH] Fix buffer overflow in password protected zip archives + +--- + fileio.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/fileio.c b/fileio.c +index 36bfea3..7c21ed0 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -1582,6 +1582,10 @@ int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) + int r = IZ_PW_ENTERED; + char *m; + char *prompt; ++ char *zfnf; ++ char *efnf; ++ size_t zfnfl; ++ int isOverflow; + + #ifndef REENTRANT + /* tell picky compilers to shut up about "unused variable" warnings */ +@@ -1590,7 +1594,15 @@ int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) + + if (*rcnt == 0) { /* First call for current entry */ + *rcnt = 2; +- if ((prompt = (char *)malloc(2*FILNAMSIZ + 15)) != (char *)NULL) { ++ zfnf = FnFilter1(zfn); ++ efnf = FnFilter2(efn); ++ zfnfl = strlen(zfnf); ++ isOverflow = TRUE; ++ if (2*FILNAMSIZ >= zfnfl && (2*FILNAMSIZ - zfnfl) >= strlen(efnf)) ++ { ++ isOverflow = FALSE; ++ } ++ if ((isOverflow == FALSE) && ((prompt = (char *)malloc(2*FILNAMSIZ + 15)) != (char *)NULL)) { + sprintf(prompt, LoadFarString(PasswPrompt), + FnFilter1(zfn), FnFilter2(efn)); + m = prompt; +-- +2.20.1 + diff --git a/pkg/unzip/patch/0021-Fix-lame-code-in-fileio.c.patch b/pkg/unzip/patch/0021-Fix-lame-code-in-fileio.c.patch @@ -0,0 +1,24 @@ +From 365c0c559506ce300793fe469394ca748dd81b50 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] Fix lame code in fileio.c + +--- + fileio.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fileio.c b/fileio.c +index 7c21ed0..c10ff63 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -2477,6 +2477,7 @@ zusz_t makeint64(sig) + */ + return (((zusz_t)sig[7]) << 56) + + (((zusz_t)sig[6]) << 48) ++ + (((zusz_t)sig[5]) << 40) + + (((zusz_t)sig[4]) << 32) + + (zusz_t)((((ulg)sig[3]) << 24) + + (((ulg)sig[2]) << 16) +-- +2.20.1 + diff --git a/pkg/unzip/patch/0022-Fix-bug-in-undefer_input-that-misplaced-the-input-st.patch b/pkg/unzip/patch/0022-Fix-bug-in-undefer_input-that-misplaced-the-input-st.patch @@ -0,0 +1,29 @@ +From 3eda39fac98550990abb9f83d986619d173f9605 Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Fri, 31 Jan 2020 22:05:56 -0800 +Subject: [PATCH] Fix bug in undefer_input() that misplaced the input state. + + Fix bug in undefer_input() that misplaced the input state. +--- + fileio.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fileio.c b/fileio.c +index c10ff63..6290824 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -532,8 +532,10 @@ void undefer_input(__G) + * This condition was checked when G.incnt_leftover was set > 0 in + * defer_leftover_input(), and it is NOT allowed to touch G.csize + * before calling undefer_input() when (G.incnt_leftover > 0) +- * (single exception: see read_byte()'s "G.csize <= 0" handling) !! ++ * (single exception: see readbyte()'s "G.csize <= 0" handling) !! + */ ++ if (G.csize < 0L) ++ G.csize = 0L; + G.incnt = G.incnt_leftover + (int)G.csize; + G.inptr = G.inptr_leftover - (int)G.csize; + G.incnt_leftover = 0; +-- +2.25.0 + diff --git a/pkg/unzip/patch/0023-Detect-and-reject-a-zip-bomb-using-overlapped-entrie.patch b/pkg/unzip/patch/0023-Detect-and-reject-a-zip-bomb-using-overlapped-entrie.patch @@ -0,0 +1,354 @@ +From 6cdb7b372b4d46e06a982c6f3494c086d2418c7b Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Fri, 31 Jan 2020 22:05:59 -0800 +Subject: [PATCH] Detect and reject a zip bomb using overlapped entries. + + Detect and reject a zip bomb using overlapped entries. + + This detects an invalid zip file that has at least one entry that + overlaps with another entry or with the central directory to the + end of the file. A Fifield zip bomb uses overlapped local entries + to vastly increase the potential inflation ratio. Such an invalid + zip file is rejected. + + See https://www.bamsoftware.com/hacks/zipbomb/ for David Fifield's + analysis, construction, and examples of such zip bombs. + + The detection maintains a list of covered spans of the zip files + so far, where the central directory to the end of the file and any + bytes preceding the first entry at zip file offset zero are + considered covered initially. Then as each entry is decompressed + or tested, it is considered covered. When a new entry is about to + be processed, its initial offset is checked to see if it is + contained by a covered span. If so, the zip file is rejected as + invalid. + + This commit depends on a preceding commit: "Fix bug in + undefer_input() that misplaced the input state." +--- + extract.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + globals.c | 1 + + globals.h | 3 + + process.c | 11 ++++ + unzip.h | 1 + + 5 files changed, 205 insertions(+), 1 deletion(-) + +diff --git a/extract.c b/extract.c +index 549a5eb..1f078d1 100644 +--- a/extract.c ++++ b/extract.c +@@ -321,6 +321,125 @@ static ZCONST char Far UnsupportedExtraField[] = + "\nerror: unsupported extra-field compression type (%u)--skipping\n"; + static ZCONST char Far BadExtraFieldCRC[] = + "error [%s]: bad extra-field CRC %08lx (should be %08lx)\n"; ++static ZCONST char Far NotEnoughMemCover[] = ++ "error: not enough memory for bomb detection\n"; ++static ZCONST char Far OverlappedComponents[] = ++ "error: invalid zip file with overlapped components (possible zip bomb)\n"; ++ ++ ++ ++ ++ ++/* A growable list of spans. */ ++typedef zoff_t bound_t; ++typedef struct { ++ bound_t beg; /* start of the span */ ++ bound_t end; /* one past the end of the span */ ++} span_t; ++typedef struct { ++ span_t *span; /* allocated, distinct, and sorted list of spans */ ++ size_t num; /* number of spans in the list */ ++ size_t max; /* allocated number of spans (num <= max) */ ++} cover_t; ++ ++/* ++ * Return the index of the first span in cover whose beg is greater than val. ++ * If there is no such span, then cover->num is returned. ++ */ ++static size_t cover_find(cover, val) ++ cover_t *cover; ++ bound_t val; ++{ ++ size_t lo = 0, hi = cover->num; ++ while (lo < hi) { ++ size_t mid = (lo + hi) >> 1; ++ if (val < cover->span[mid].beg) ++ hi = mid; ++ else ++ lo = mid + 1; ++ } ++ return hi; ++} ++ ++/* Return true if val lies within any one of the spans in cover. */ ++static int cover_within(cover, val) ++ cover_t *cover; ++ bound_t val; ++{ ++ size_t pos = cover_find(cover, val); ++ return pos > 0 && val < cover->span[pos - 1].end; ++} ++ ++/* ++ * Add a new span to the list, but only if the new span does not overlap any ++ * spans already in the list. The new span covers the values beg..end-1. beg ++ * must be less than end. ++ * ++ * Keep the list sorted and merge adjacent spans. Grow the allocated space for ++ * the list as needed. On success, 0 is returned. If the new span overlaps any ++ * existing spans, then 1 is returned and the new span is not added to the ++ * list. If the new span is invalid because beg is greater than or equal to ++ * end, then -1 is returned. If the list needs to be grown but the memory ++ * allocation fails, then -2 is returned. ++ */ ++static int cover_add(cover, beg, end) ++ cover_t *cover; ++ bound_t beg; ++ bound_t end; ++{ ++ size_t pos; ++ int prec, foll; ++ ++ if (beg >= end) ++ /* The new span is invalid. */ ++ return -1; ++ ++ /* Find where the new span should go, and make sure that it does not ++ overlap with any existing spans. */ ++ pos = cover_find(cover, beg); ++ if ((pos > 0 && beg < cover->span[pos - 1].end) || ++ (pos < cover->num && end > cover->span[pos].beg)) ++ return 1; ++ ++ /* Check for adjacencies. */ ++ prec = pos > 0 && beg == cover->span[pos - 1].end; ++ foll = pos < cover->num && end == cover->span[pos].beg; ++ if (prec && foll) { ++ /* The new span connects the preceding and following spans. Merge the ++ following span into the preceding span, and delete the following ++ span. */ ++ cover->span[pos - 1].end = cover->span[pos].end; ++ cover->num--; ++ memmove(cover->span + pos, cover->span + pos + 1, ++ (cover->num - pos) * sizeof(span_t)); ++ } ++ else if (prec) ++ /* The new span is adjacent only to the preceding span. Extend the end ++ of the preceding span. */ ++ cover->span[pos - 1].end = end; ++ else if (foll) ++ /* The new span is adjacent only to the following span. Extend the ++ beginning of the following span. */ ++ cover->span[pos].beg = beg; ++ else { ++ /* The new span has gaps between both the preceding and the following ++ spans. Assure that there is room and insert the span. */ ++ if (cover->num == cover->max) { ++ size_t max = cover->max == 0 ? 16 : cover->max << 1; ++ span_t *span = realloc(cover->span, max * sizeof(span_t)); ++ if (span == NULL) ++ return -2; ++ cover->span = span; ++ cover->max = max; ++ } ++ memmove(cover->span + pos + 1, cover->span + pos, ++ (cover->num - pos) * sizeof(span_t)); ++ cover->num++; ++ cover->span[pos].beg = beg; ++ cover->span[pos].end = end; ++ } ++ return 0; ++} + + + +@@ -376,6 +495,29 @@ int extract_or_test_files(__G) /* return PK-type error code */ + } + #endif /* !SFX || SFX_EXDIR */ + ++ /* One more: initialize cover structure for bomb detection. Start with a ++ span that covers the central directory though the end of the file. */ ++ if (G.cover == NULL) { ++ G.cover = malloc(sizeof(cover_t)); ++ if (G.cover == NULL) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(NotEnoughMemCover))); ++ return PK_MEM; ++ } ++ ((cover_t *)G.cover)->span = NULL; ++ ((cover_t *)G.cover)->max = 0; ++ } ++ ((cover_t *)G.cover)->num = 0; ++ if ((G.extra_bytes != 0 && ++ cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) || ++ cover_add((cover_t *)G.cover, ++ G.extra_bytes + G.ecrec.offset_start_central_directory, ++ G.ziplen) != 0) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(NotEnoughMemCover))); ++ return PK_MEM; ++ } ++ + /*--------------------------------------------------------------------------- + The basic idea of this function is as follows. Since the central di- + rectory lies at the end of the zipfile and the member files lie at the +@@ -593,7 +735,8 @@ int extract_or_test_files(__G) /* return PK-type error code */ + if (error > error_in_archive) + error_in_archive = error; + /* ...and keep going (unless disk full or user break) */ +- if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) { ++ if (G.disk_full > 1 || error_in_archive == IZ_CTRLC || ++ error == PK_BOMB) { + /* clear reached_end to signal premature stop ... */ + reached_end = FALSE; + /* ... and cancel scanning the central directory */ +@@ -1062,6 +1205,11 @@ static int extract_or_test_entrylist(__G__ numchunk, + + /* seek_zipf(__G__ pInfo->offset); */ + request = G.pInfo->offset + G.extra_bytes; ++ if (cover_within((cover_t *)G.cover, request)) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(OverlappedComponents))); ++ return PK_BOMB; ++ } + inbuf_offset = request % INBUFSIZ; + bufstart = request - inbuf_offset; + +@@ -1602,6 +1750,18 @@ reprompt: + return IZ_CTRLC; /* cancel operation by user request */ + } + #endif ++ error = cover_add((cover_t *)G.cover, request, ++ G.cur_zipfile_bufstart + (G.inptr - G.inbuf)); ++ if (error < 0) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(NotEnoughMemCover))); ++ return PK_MEM; ++ } ++ if (error != 0) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(OverlappedComponents))); ++ return PK_BOMB; ++ } + #ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); + #endif +@@ -2003,6 +2163,34 @@ static int extract_or_test_member(__G) /* return PK-type error code */ + } + + undefer_input(__G); ++ ++ if ((G.lrec.general_purpose_bit_flag & 8) != 0) { ++ /* skip over data descriptor (harder than it sounds, due to signature ++ * ambiguity) ++ */ ++# define SIG 0x08074b50 ++# define LOW 0xffffffff ++ uch buf[12]; ++ unsigned shy = 12 - readbuf((char *)buf, 12); ++ ulg crc = shy ? 0 : makelong(buf); ++ ulg clen = shy ? 0 : makelong(buf + 4); ++ ulg ulen = shy ? 0 : makelong(buf + 8); /* or high clen if ZIP64 */ ++ if (crc == SIG && /* if not SIG, no signature */ ++ (G.lrec.crc32 != SIG || /* if not SIG, have signature */ ++ (clen == SIG && /* if not SIG, no signature */ ++ ((G.lrec.csize & LOW) != SIG || /* if not SIG, have signature */ ++ (ulen == SIG && /* if not SIG, no signature */ ++ (G.zip64 ? G.lrec.csize >> 32 : G.lrec.ucsize) != SIG ++ /* if not SIG, have signature */ ++ ))))) ++ /* skip four more bytes to account for signature */ ++ shy += 4 - readbuf((char *)buf, 4); ++ if (G.zip64) ++ shy += 8 - readbuf((char *)buf, 8); /* skip eight more for ZIP64 */ ++ if (shy) ++ error = PK_ERR; ++ } ++ + return error; + + } /* end function extract_or_test_member() */ +diff --git a/globals.c b/globals.c +index fa8cca5..1e0f608 100644 +--- a/globals.c ++++ b/globals.c +@@ -181,6 +181,7 @@ Uz_Globs *globalsCtor() + # if (!defined(NO_TIMESTAMPS)) + uO.D_flag=1; /* default to '-D', no restoration of dir timestamps */ + # endif ++ G.cover = NULL; /* not allocated yet */ + #endif + + uO.lflag=(-1); +diff --git a/globals.h b/globals.h +index 11b7215..2bdcdeb 100644 +--- a/globals.h ++++ b/globals.h +@@ -260,12 +260,15 @@ typedef struct Globals { + ecdir_rec ecrec; /* used in unzip.c, extract.c */ + z_stat statbuf; /* used by main, mapname, check_for_newer */ + ++ int zip64; /* true if Zip64 info in extra field */ ++ + int mem_mode; + uch *outbufptr; /* extract.c static */ + ulg outsize; /* extract.c static */ + int reported_backslash; /* extract.c static */ + int disk_full; + int newfile; ++ void **cover; /* used in extract.c for bomb detection */ + + int didCRlast; /* fileio static */ + ulg numlines; /* fileio static: number of lines printed */ +diff --git a/process.c b/process.c +index e4f2405..e4e7aee 100644 +--- a/process.c ++++ b/process.c +@@ -637,6 +637,13 @@ void free_G_buffers(__G) /* releases all memory allocated in global vars */ + } + #endif + ++ /* Free the cover span list and the cover structure. */ ++ if (G.cover != NULL) { ++ free(*(G.cover)); ++ free(G.cover); ++ G.cover = NULL; ++ } ++ + } /* end function free_G_buffers() */ + + +@@ -1913,6 +1920,8 @@ int getZip64Data(__G__ ef_buf, ef_len) + #define Z64FLGS 0xffff + #define Z64FLGL 0xffffffff + ++ G.zip64 = FALSE; ++ + if (ef_len == 0 || ef_buf == NULL) + return PK_COOL; + +@@ -2084,6 +2093,8 @@ int getUnicodeData(__G__ ef_buf, ef_len) + (ZCONST char *)(offset + ef_buf), ULen); + G.unipath_filename[ULen] = '\0'; + } ++ ++ G.zip64 = TRUE; + } + + /* Skip this extra field block */ +diff --git a/unzip.h b/unzip.h +index 5b2a326..ed24a5b 100644 +--- a/unzip.h ++++ b/unzip.h +@@ -645,6 +645,7 @@ typedef struct _Uzp_cdir_Rec { + #define PK_NOZIP 9 /* zipfile not found */ + #define PK_PARAM 10 /* bad or illegal parameters specified */ + #define PK_FIND 11 /* no files found */ ++#define PK_BOMB 12 /* likely zip bomb */ + #define PK_DISK 50 /* disk full */ + #define PK_EOF 51 /* unexpected EOF */ + +-- +2.25.0 + diff --git a/pkg/unzip/patch/0024-Do-not-raise-a-zip-bomb-alert-for-a-misplaced-centra.patch b/pkg/unzip/patch/0024-Do-not-raise-a-zip-bomb-alert-for-a-misplaced-centra.patch @@ -0,0 +1,117 @@ +From 9d516b8c761d3816f946aa8937ebf9fadfe6a002 Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Fri, 31 Jan 2020 22:06:02 -0800 +Subject: [PATCH] Do not raise a zip bomb alert for a misplaced central + directory. + + Do not raise a zip bomb alert for a misplaced central directory. + + There is a zip-like file in the Firefox distribution, omni.ja, + which is a zip container with the central directory placed at the + start of the file instead of after the local entries as required + by the zip standard. This commit marks the actual location of the + central directory, as well as the end of central directory records, + as disallowed locations. This now permits such containers to not + raise a zip bomb alert, where in fact there are no overlaps. +--- + extract.c | 25 +++++++++++++++++++------ + process.c | 6 ++++++ + unzpriv.h | 10 ++++++++++ + 3 files changed, 35 insertions(+), 6 deletions(-) + +diff --git a/extract.c b/extract.c +index 1f078d1..ad5daac 100644 +--- a/extract.c ++++ b/extract.c +@@ -495,8 +495,11 @@ int extract_or_test_files(__G) /* return PK-type error code */ + } + #endif /* !SFX || SFX_EXDIR */ + +- /* One more: initialize cover structure for bomb detection. Start with a +- span that covers the central directory though the end of the file. */ ++ /* One more: initialize cover structure for bomb detection. Start with ++ spans that cover any extra bytes at the start, the central directory, ++ the end of central directory record (including the Zip64 end of central ++ directory locator, if present), and the Zip64 end of central directory ++ record, if present. */ + if (G.cover == NULL) { + G.cover = malloc(sizeof(cover_t)); + if (G.cover == NULL) { +@@ -508,15 +511,25 @@ int extract_or_test_files(__G) /* return PK-type error code */ + ((cover_t *)G.cover)->max = 0; + } + ((cover_t *)G.cover)->num = 0; +- if ((G.extra_bytes != 0 && +- cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) || +- cover_add((cover_t *)G.cover, ++ if (cover_add((cover_t *)G.cover, + G.extra_bytes + G.ecrec.offset_start_central_directory, +- G.ziplen) != 0) { ++ G.extra_bytes + G.ecrec.offset_start_central_directory + ++ G.ecrec.size_central_directory) != 0) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(NotEnoughMemCover))); + return PK_MEM; + } ++ if ((G.extra_bytes != 0 && ++ cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) || ++ (G.ecrec.have_ecr64 && ++ cover_add((cover_t *)G.cover, G.ecrec.ec64_start, ++ G.ecrec.ec64_end) != 0) || ++ cover_add((cover_t *)G.cover, G.ecrec.ec_start, ++ G.ecrec.ec_end) != 0) { ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(OverlappedComponents))); ++ return PK_BOMB; ++ } + + /*--------------------------------------------------------------------------- + The basic idea of this function is as follows. Since the central di- +diff --git a/process.c b/process.c +index e4e7aee..d2a846e 100644 +--- a/process.c ++++ b/process.c +@@ -1408,6 +1408,10 @@ static int find_ecrec64(__G__ searchlen) /* return PK-class error */ + + /* Now, we are (almost) sure that we have a Zip64 archive. */ + G.ecrec.have_ecr64 = 1; ++ G.ecrec.ec_start -= ECLOC64_SIZE+4; ++ G.ecrec.ec64_start = ecrec64_start_offset; ++ G.ecrec.ec64_end = ecrec64_start_offset + ++ 12 + makeint64(&byterec[ECREC64_LENGTH]); + + /* Update the "end-of-central-dir offset" for later checks. */ + G.real_ecrec_offset = ecrec64_start_offset; +@@ -1542,6 +1546,8 @@ static int find_ecrec(__G__ searchlen) /* return PK-class error */ + makelong(&byterec[OFFSET_START_CENTRAL_DIRECTORY]); + G.ecrec.zipfile_comment_length = + makeword(&byterec[ZIPFILE_COMMENT_LENGTH]); ++ G.ecrec.ec_start = G.real_ecrec_offset; ++ G.ecrec.ec_end = G.ecrec.ec_start + 22 + G.ecrec.zipfile_comment_length; + + /* Now, we have to read the archive comment, BEFORE the file pointer + is moved away backwards to seek for a Zip64 ECLOC64 structure. +diff --git a/unzpriv.h b/unzpriv.h +index dc9eff5..297b3c7 100644 +--- a/unzpriv.h ++++ b/unzpriv.h +@@ -2185,6 +2185,16 @@ typedef struct VMStimbuf { + int have_ecr64; /* valid Zip64 ecdir-record exists */ + int is_zip64_archive; /* Zip64 ecdir-record is mandatory */ + ush zipfile_comment_length; ++ zusz_t ec_start, ec_end; /* offsets of start and end of the ++ end of central directory record, ++ including if present the Zip64 ++ end of central directory locator, ++ which immediately precedes the ++ end of central directory record */ ++ zusz_t ec64_start, ec64_end; /* if have_ecr64 is true, then these ++ are the offsets of the start and ++ end of the Zip64 end of central ++ directory record */ + } ecdir_rec; + + +-- +2.25.0 + diff --git a/pkg/unzip/patch/0025-Fix-bug-in-UZbunzip2-that-incorrectly-updated-G.incn.patch b/pkg/unzip/patch/0025-Fix-bug-in-UZbunzip2-that-incorrectly-updated-G.incn.patch @@ -0,0 +1,30 @@ +From 705923de022bad2ce0142ccbab68aa57ebe36db1 Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Fix bug in UZbunzip2() that incorrectly updated G.incnt + + Fix bug in UZbunzip2() that incorrectly updated G.incnt. + + The update assumed a full buffer, which is not always full. This + could result in a false overlapped element detection when a small + bzip2-compressed file was unzipped. This commit remedies that. +--- + extract.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/extract.c b/extract.c +index ad5daac..6712ed0 100644 +--- a/extract.c ++++ b/extract.c +@@ -3052,7 +3052,7 @@ __GDEF + #endif + + G.inptr = (uch *)bstrm.next_in; +- G.incnt = (G.inbuf + INBUFSIZ) - G.inptr; /* reset for other routines */ ++ G.incnt -= G.inptr - G.inbuf; /* reset for other routines */ + + uzbunzip_cleanup_exit: + err = BZ2_bzDecompressEnd(&bstrm); +-- +2.45.2 + diff --git a/pkg/unzip/patch/0025-Use-long-long-with-C99-compilers.patch b/pkg/unzip/patch/0025-Use-long-long-with-C99-compilers.patch @@ -0,0 +1,25 @@ +From f731106313a5edc37b5cbef93da6be855f24c238 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sat, 15 Jun 2019 18:16:56 -0700 +Subject: [PATCH] Use `long long` with C99 compilers + +--- + unzpriv.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/unzpriv.h b/unzpriv.h +index dc9eff5..8f18b87 100644 +--- a/unzpriv.h ++++ b/unzpriv.h +@@ -1904,7 +1904,7 @@ + + #ifdef ZIP64_SUPPORT + # ifndef Z_UINT8_DEFINED +-# if (defined(__GNUC__) || defined(__hpux) || defined(__SUNPRO_C)) ++# if (defined(__GNUC__) || defined(__hpux) || defined(__SUNPRO_C) || __STDC_VERSION__ > 199901L) + typedef unsigned long long z_uint8; + # else + typedef unsigned __int64 z_uint8; +-- +2.20.1 + diff --git a/pkg/unzip/patch/0026-Fix-bug-in-UZinflate-that-incorrectly-updated-G.incn.patch b/pkg/unzip/patch/0026-Fix-bug-in-UZinflate-that-incorrectly-updated-G.incn.patch @@ -0,0 +1,31 @@ +From a07b1c0bb82b6dc0f8f224894e49eb9b44a076db Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Fix bug in UZinflate() that incorrectly updated G.incnt. + + Fix bug in UZinflate() that incorrectly updated G.incnt. + + The update assumed a full buffer, which is not always full. This + could result in a false overlapped element detection when a small + deflate-compressed file was unzipped using an old zlib. This + commit remedies that. +--- + inflate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/inflate.c b/inflate.c +index f2f6864..2c37999 100644 +--- a/inflate.c ++++ b/inflate.c +@@ -700,7 +700,7 @@ int UZinflate(__G__ is_defl64) + G.dstrm.total_out)); + + G.inptr = (uch *)G.dstrm.next_in; +- G.incnt = (G.inbuf + INBUFSIZ) - G.inptr; /* reset for other routines */ ++ G.incnt -= G.inptr - G.inbuf; /* reset for other routines */ + + uzinflate_cleanup_exit: + err = inflateReset(&G.dstrm); +-- +2.45.2 + diff --git a/pkg/unzip/patch/0027-zipgrep-Avoid-test-errors-when-no-members-present.patch b/pkg/unzip/patch/0027-zipgrep-Avoid-test-errors-when-no-members-present.patch @@ -0,0 +1,24 @@ +From 765b05298e4959bea8a77295704c9461fa9218d1 Mon Sep 17 00:00:00 2001 +From: Kevin Locke <kevin@kevinlocke.name> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] zipgrep: Avoid test errors when no members present + +--- + unix/zipgrep | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/unix/zipgrep b/unix/zipgrep +index 69cd6ba..b9d2316 100755 +--- a/unix/zipgrep ++++ b/unix/zipgrep +@@ -44,6 +44,7 @@ if test -n "$opt"; then + opt="-$opt" + fi + ++sts=0 + status_grep_global=1 + IFS=' + ' +-- +2.45.2 + diff --git a/pkg/unzip/patch/0028-Fix-for-CVE-2022-0529-and-CVE-2022-0530.patch b/pkg/unzip/patch/0028-Fix-for-CVE-2022-0529-and-CVE-2022-0530.patch @@ -0,0 +1,185 @@ +From 7c5862de85894d5387c855b5df6e5509c97f5bdf Mon Sep 17 00:00:00 2001 +From: "Steven M. Schweda" <sms@antinode.info> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Fix for CVE-2022-0529 and CVE-2022-0530 + +--- + fileio.c | 34 +++++++++++++++++++++++++--------- + process.c | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- + 2 files changed, 69 insertions(+), 20 deletions(-) + +diff --git a/fileio.c b/fileio.c +index 6290824..50a74fc 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -171,8 +171,10 @@ static ZCONST char Far ReadError[] = "error: zipfile read error\n"; + static ZCONST char Far FilenameTooLongTrunc[] = + "warning: filename too long--truncating.\n"; + #ifdef UNICODE_SUPPORT ++ static ZCONST char Far UFilenameCorrupt[] = ++ "error: Unicode filename corrupt.\n"; + static ZCONST char Far UFilenameTooLongTrunc[] = +- "warning: Converted unicode filename too long--truncating.\n"; ++ "warning: Converted Unicode filename too long--truncating.\n"; + #endif + static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; +@@ -2361,16 +2363,30 @@ int do_string(__G__ length, option) /* return PK-type error code */ + /* convert UTF-8 to local character set */ + fn = utf8_to_local_string(G.unipath_filename, + G.unicode_escape_all); +- /* make sure filename is short enough */ +- if (strlen(fn) >= FILNAMSIZ) { +- fn[FILNAMSIZ - 1] = '\0'; ++ ++ /* 2022-07-22 SMS, et al. CVE-2022-0530 ++ * Detect conversion failure, emit message. ++ * Continue with unconverted name. ++ */ ++ if (fn == NULL) ++ { + Info(slide, 0x401, ((char *)slide, +- LoadFarString(UFilenameTooLongTrunc))); +- error = PK_WARN; ++ LoadFarString(UFilenameCorrupt))); ++ error = PK_ERR; ++ } ++ else ++ { ++ /* make sure filename is short enough */ ++ if (strlen(fn) >= FILNAMSIZ) { ++ fn[FILNAMSIZ - 1] = '\0'; ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString(UFilenameTooLongTrunc))); ++ error = PK_WARN; ++ } ++ /* replace filename with converted UTF-8 */ ++ strcpy(G.filename, fn); ++ free(fn); + } +- /* replace filename with converted UTF-8 */ +- strcpy(G.filename, fn); +- free(fn); + } + # endif /* UNICODE_WCHAR */ + if (G.unipath_filename != G.filename_full) +diff --git a/process.c b/process.c +index d2a846e..a7d5b87 100644 +--- a/process.c ++++ b/process.c +@@ -222,6 +222,8 @@ static ZCONST char Far ZipfileCommTrunc1[] = + "\nwarning: Unicode Path version > 1\n"; + static ZCONST char Far UnicodeMismatchError[] = + "\nwarning: Unicode Path checksum invalid\n"; ++ static ZCONST char Far UFilenameTooLongTrunc[] = ++ "warning: filename too long (P1) -- truncating.\n"; + #endif + + +@@ -1915,7 +1917,7 @@ int getZip64Data(__G__ ef_buf, ef_len) + Sets both local header and central header fields. Not terribly clever, + but it means that this procedure is only called in one place. + +- 2014-12-05 SMS. ++ 2014-12-05 SMS. (oCERT.org report.) CVE-2014-8141. + Added checks to ensure that enough data are available before calling + makeint64() or makelong(). Replaced various sizeof() values with + simple ("4" or "8") constants. (The Zip64 structures do not depend +@@ -1947,9 +1949,10 @@ int getZip64Data(__G__ ef_buf, ef_len) + ef_len - EB_HEADSIZE)); + break; + } ++ + if (eb_id == EF_PKSZ64) + { +- int offset = EB_HEADSIZE; ++ unsigned offset = EB_HEADSIZE; + + if ((G.crec.ucsize == Z64FLGL) || (G.lrec.ucsize == Z64FLGL)) + { +@@ -2046,7 +2049,7 @@ int getUnicodeData(__G__ ef_buf, ef_len) + } + if (eb_id == EF_UNIPATH) { + +- int offset = EB_HEADSIZE; ++ unsigned offset = EB_HEADSIZE; + ush ULen = eb_len - 5; + ulg chksum = CRCVAL_INITIAL; + +@@ -2504,16 +2507,17 @@ char *wide_to_local_string(wide_string, escape_all) + int state_dependent; + int wsize = 0; + int max_bytes = MB_CUR_MAX; +- char buf[9]; ++ char buf[ MB_CUR_MAX+ 1]; /* ("+1" not really needed?) */ + char *buffer = NULL; + char *local_string = NULL; ++ size_t buffer_size; /* CVE-2022-0529 */ + + for (wsize = 0; wide_string[wsize]; wsize++) ; + + if (max_bytes < MAX_ESCAPE_BYTES) + max_bytes = MAX_ESCAPE_BYTES; +- +- if ((buffer = (char *)malloc(wsize * max_bytes + 1)) == NULL) { ++ buffer_size = wsize * max_bytes + 1; /* Reused below. */ ++ if ((buffer = (char *)malloc( buffer_size)) == NULL) { + return NULL; + } + +@@ -2551,8 +2555,28 @@ char *wide_to_local_string(wide_string, escape_all) + } else { + /* no MB for this wide */ + /* use escape for wide character */ +- char *escape_string = wide_to_escape_string(wide_string[i]); +- strcat(buffer, escape_string); ++ size_t buffer_len; ++ size_t escape_string_len; ++ char *escape_string; ++ int err_msg = 0; ++ ++ escape_string = wide_to_escape_string(wide_string[i]); ++ buffer_len = strlen( buffer); ++ escape_string_len = strlen( escape_string); ++ ++ /* Append escape string, as space allows. */ ++ /* 2022-07-18 SMS, et al. CVE-2022-0529 */ ++ if (escape_string_len > buffer_size- buffer_len- 1) ++ { ++ escape_string_len = buffer_size- buffer_len- 1; ++ if (err_msg == 0) ++ { ++ err_msg = 1; ++ Info(slide, 0x401, ((char *)slide, ++ LoadFarString( UFilenameTooLongTrunc))); ++ } ++ } ++ strncat( buffer, escape_string, escape_string_len); + free(escape_string); + } + } +@@ -2604,9 +2628,18 @@ char *utf8_to_local_string(utf8_string, escape_all) + ZCONST char *utf8_string; + int escape_all; + { +- zwchar *wide = utf8_to_wide_string(utf8_string); +- char *loc = wide_to_local_string(wide, escape_all); +- free(wide); ++ zwchar *wide; ++ char *loc = NULL; ++ ++ wide = utf8_to_wide_string( utf8_string); ++ ++ /* 2022-07-25 SMS, et al. CVE-2022-0530 */ ++ if (wide != NULL) ++ { ++ loc = wide_to_local_string( wide, escape_all); ++ free( wide); ++ } ++ + return loc; + } + +-- +2.45.2 + diff --git a/pkg/unzip/patch/0029-Handle-Microsoft-ZIP64-files-by-ignoring-invalid-Tot.patch b/pkg/unzip/patch/0029-Handle-Microsoft-ZIP64-files-by-ignoring-invalid-Tot.patch @@ -0,0 +1,26 @@ +From 94b2d0b50a3a231ef91319e8e633b7ea62f0e2db Mon Sep 17 00:00:00 2001 +From: Roy Tam <roytam@gmail.com> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Handle Microsoft ZIP64 files by ignoring invalid "Total + number of disks" field + +--- + process.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/process.c b/process.c +index a7d5b87..b385f1e 100644 +--- a/process.c ++++ b/process.c +@@ -1281,7 +1281,7 @@ static int find_ecrec64(__G__ searchlen) /* return PK-class error */ + fprintf(stdout,"\nnumber of disks (ECR) %u, (ECLOC64) %lu\n", + G.ecrec.number_this_disk, ecloc64_total_disks); fflush(stdout); + #endif +- if ((G.ecrec.number_this_disk != 0xFFFF) && ++ if ((G.ecrec.number_this_disk != 0xFFFF) && ecloc64_total_disks && + (G.ecrec.number_this_disk != ecloc64_total_disks - 1)) { + /* Note: For some unknown reason, the developers at PKWARE decided to + store the "zip64 total disks" value as a counter starting from 1, +-- +2.45.2 + diff --git a/pkg/unzip/patch/0030-Drop-conflicting-declarations-of-gmtime-and-localtim.patch b/pkg/unzip/patch/0030-Drop-conflicting-declarations-of-gmtime-and-localtim.patch @@ -0,0 +1,25 @@ +From 7fb1835d3ec1654edd2b1b88575cc9eedb1b0f03 Mon Sep 17 00:00:00 2001 +From: Santiago Vila <sanvila@debian.org> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Drop conflicting declarations of gmtime() and localtime() + +--- + unix/unxcfg.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/unix/unxcfg.h b/unix/unxcfg.h +index c98c3b9..a3ad576 100644 +--- a/unix/unxcfg.h ++++ b/unix/unxcfg.h +@@ -118,7 +118,7 @@ typedef struct stat z_stat; + # endif + #else + # include <time.h> +- struct tm *gmtime(), *localtime(); ++/* struct tm *gmtime(), *localtime(); */ + #endif + + #if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN))) +-- +2.45.2 + diff --git a/pkg/unzip/patch/0031-Do-not-escape-shell-special-characters-in-pat.patch b/pkg/unzip/patch/0031-Do-not-escape-shell-special-characters-in-pat.patch @@ -0,0 +1,27 @@ +From 39d270017e54c35683eab58de5059eda6d697c97 Mon Sep 17 00:00:00 2001 +From: Vincent Lefevre <vincent@vinc17.net> +Date: Mon, 28 Apr 2025 12:57:34 -0700 +Subject: [PATCH] Do not escape shell-special characters in "pat" + +--- + unix/zipgrep | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/unix/zipgrep b/unix/zipgrep +index b9d2316..3ac7612 100755 +--- a/unix/zipgrep ++++ b/unix/zipgrep +@@ -49,10 +49,6 @@ status_grep_global=1 + IFS=' + ' + +-# Escape shell-special characters in "pat". +-pat=` echo "$pat" | \ +- sed -e 's/\\\\/\\\\\\\\/g' -e 's/|/\\\|/g' -e 's/&/\\\&/g' ` +- + # Use "unzip -Z1" to get a listing of the specified members from the + # specified archive. Escape any backslashes in a file name. + for i in `unzip -Z1 "$zipfile" ${1+"$@"} | sed -e 's/\\\\/\\\\\\\\/g' `; do +-- +2.45.2 + diff --git a/pkg/unzip/patch/0032-Remove-use-of-non-prototype-function-definitions.patch b/pkg/unzip/patch/0032-Remove-use-of-non-prototype-function-definitions.patch @@ -0,0 +1,2128 @@ +From e53bad1be991d7b1d544625c92d4ff346946a635 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Wed, 1 Apr 2026 19:56:35 -0700 +Subject: [PATCH] Remove use of non-prototype function definitions + +--- + amiga/smakefile | 2 +- + aosvs/make_unz.cli | 2 +- + crc32.c | 9 +-- + crypt.c | 37 +++++----- + envargs.c | 8 +-- + explode.c | 37 ++++++---- + extract.c | 120 ++++++++++++--------------------- + fileio.c | 164 +++++++++++++++++++++------------------------ + inflate.c | 50 +++++++------- + list.c | 9 +-- + match.c | 31 ++++----- + process.c | 161 ++++++++++++++++++-------------------------- + ttyio.c | 60 +++++++++-------- + ubz2err.c | 3 +- + unix/configure | 5 -- + unix/unix.c | 56 +++++----------- + unshrink.c | 7 +- + unzip.c | 39 ++++------- + unzip.h | 57 +++------------- + zipinfo.c | 37 ++++------ + 20 files changed, 360 insertions(+), 534 deletions(-) + +diff --git a/amiga/smakefile b/amiga/smakefile +index 48818f9..bf5c282 100644 +--- a/amiga/smakefile ++++ b/amiga/smakefile +@@ -275,7 +275,7 @@ CCPUOPTSF = CPU=$(CUSECPU) $(CUTIL) + # cpu flags for UnzipSFX and MakeSFX (ensures portability to all Amigas) + CCPUOPTXM = CPU=ANY + +-CDEFINES = $(CMEMLIB) $(CDEFINES) DEF=AMIGA DEF=PROTO ++CDEFINES = $(CMEMLIB) $(CDEFINES) DEF=AMIGA + COPTIONS = CODE=NEAR NMINC VERBOSE STRINGMERGE PARAMETERS=BOTH + COPTIONS = $(COPTIONS) ERRORREXX NOERRORCONSOLE MEMSIZE=HUGE $(CLIST) $(CXREF) + COPTIONS = $(COPTIONS) $(CSTACK) STRICT UNSCHAR NOICONS +diff --git a/aosvs/make_unz.cli b/aosvs/make_unz.cli +index 8daf91e..0704944 100644 +--- a/aosvs/make_unz.cli ++++ b/aosvs/make_unz.cli +@@ -1,5 +1,5 @@ + push + prompt pop + searchlist :c_4.10 :c_4.10:lang_rt [!searchlist] +-cc/link/NOUNX/NOSEA SYSV/DEFINE TERMIO/DEFINE AOS_VS/DEFINE=1 PROTO/DEFINE S_IFLNK/DEFINE=0120000 TIME.H/INCLUDE <unzip crc32 crypt envargs explode extract fileio globals inflate list match process ttyio ubz2err unreduce unshrink zipinfo aosvs>.c ++cc/link/NOUNX/NOSEA SYSV/DEFINE TERMIO/DEFINE AOS_VS/DEFINE=1 S_IFLNK/DEFINE=0120000 TIME.H/INCLUDE <unzip crc32 crypt envargs explode extract fileio globals inflate list match process ttyio ubz2err unreduce unshrink zipinfo aosvs>.c + pop +diff --git a/crc32.c b/crc32.c +index 02f504d..036d9e3 100644 +--- a/crc32.c ++++ b/crc32.c +@@ -677,13 +677,14 @@ void free_crc_table() + + + /* ========================================================================= */ +-ulg crc32(crc, buf, len) +- ulg crc; /* crc shift register */ +- register ZCONST uch *buf; /* pointer to bytes to pump through */ +- extent len; /* number of bytes in buf[] */ + /* Run a set of bytes through the crc shift register. If buf is a NULL + pointer, then initialize the crc shift register contents instead. + Return the current crc in either case. */ ++ulg crc32( ++ ulg crc, /* crc shift register */ ++ register ZCONST uch *buf, /* pointer to bytes to pump through */ ++ extent len /* number of bytes in buf[] */ ++) + { + register z_uint4 c; + register ZCONST ulg near *crc_32_tab; +diff --git a/crypt.c b/crypt.c +index a8975f2..74ddc2a 100644 +--- a/crypt.c ++++ b/crypt.c +@@ -146,8 +146,7 @@ + /*********************************************************************** + * Return the next byte in the pseudo-random sequence + */ +-int decrypt_byte(__G) +- __GDEF ++int decrypt_byte(__GPRO) + { + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem +@@ -160,9 +159,10 @@ int decrypt_byte(__G) + /*********************************************************************** + * Update the encryption keys with the next byte of plain text + */ +-int update_keys(__G__ c) +- __GDEF +- int c; /* byte of plain text */ ++int update_keys( ++ __GPRO__ ++ int c /* byte of plain text */ ++) + { + GLOBAL(keys[0]) = CRC32(GLOBAL(keys[0]), c, CRY_CRC_TAB); + GLOBAL(keys[1]) = (GLOBAL(keys[1]) +@@ -180,9 +180,10 @@ int update_keys(__G__ c) + * Initialize the encryption keys and the random header according to + * the given password. + */ +-void init_keys(__G__ passwd) +- __GDEF +- ZCONST char *passwd; /* password string with which to modify keys */ ++void init_keys( ++ __GPRO__ ++ ZCONST char *passwd /* password string with which to modify keys */ ++) + { + #ifdef IZ_CRC_BE_OPTIMIZ + if (cry_crctb_p == NULL) { +@@ -209,8 +210,7 @@ void init_keys(__G__ passwd) + * crypt-crc32-table. + */ + #ifdef IZ_CRC_BE_OPTIMIZ +-local z_uint4 near *crytab_init(__G) +- __GDEF ++local z_uint4 near *crytab_init(__GPRO) + { + int i; + +@@ -450,9 +450,7 @@ unsigned zfwrite(buf, item_size, nb, f) + * Get the password and set up keys for current zipfile member. + * Return PK_ class error. + */ +-int decrypt(__G__ passwrd) +- __GDEF +- ZCONST char *passwrd; ++int decrypt(__GPRO__ ZCONST char *passwrd) + { + ush b; + int n, r; +@@ -536,9 +534,7 @@ int decrypt(__G__ passwrd) + /*********************************************************************** + * Test the password. Return -1 if bad, 0 if OK. + */ +-local int testp(__G__ h) +- __GDEF +- ZCONST uch *h; ++local int testp(__GPRO__ ZCONST uch *h) + { + int r; + char *key_translated; +@@ -591,10 +587,11 @@ local int testp(__G__ h) + } /* end function testp() */ + + +-local int testkey(__G__ h, key) +- __GDEF +- ZCONST uch *h; /* decrypted header */ +- ZCONST char *key; /* decryption password to test */ ++local int testkey( ++ __GPRO__ ++ ZCONST uch *h, /* decrypted header */ ++ ZCONST char *key /* decryption password to test */ ++) + { + ush b; + #ifdef ZIP10 +diff --git a/envargs.c b/envargs.c +index f0a230d..05a7902 100644 +--- a/envargs.c ++++ b/envargs.c +@@ -46,10 +46,7 @@ static int count_args OF((ZCONST char *)); + + /* envargs() returns PK-style error code */ + +-int envargs(Pargc, Pargv, envstr, envstr2) +- int *Pargc; +- char ***Pargv; +- ZCONST char *envstr, *envstr2; ++int envargs(int *Pargc, char ***Pargv, ZCONST char *envstr, ZCONST char *envstr2) + { + char *envptr; /* value returned by getenv */ + char *bufptr; /* copy of env info */ +@@ -176,8 +173,7 @@ int envargs(Pargc, Pargv, envstr, envstr2) + + + +-static int count_args(s) +- ZCONST char *s; ++static int count_args(ZCONST char *s) + { + int count = 0; + char ch; +diff --git a/explode.c b/explode.c +index 3b558c2..9d79467 100644 +--- a/explode.c ++++ b/explode.c +@@ -219,13 +219,14 @@ static ZCONST ush cpdist8[] = + } + + +-static int get_tree(__G__ l, n) +- __GDEF +-unsigned *l; /* bit lengths */ +-unsigned n; /* number expected */ + /* Get the bit lengths for a code representation from the compressed + stream. If get_tree() returns 4, then there is an error in the data. + Otherwise zero is returned. */ ++static int get_tree( ++ __GDEF ++ unsigned *l, /* bit lengths */ ++ unsigned n /* number expected */ ++) + { + unsigned i; /* bytes remaining in list */ + unsigned k; /* lengths entered */ +@@ -250,13 +251,18 @@ unsigned n; /* number expected */ + + + +-static int explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl) +- __GDEF +-struct huft *tb, *tl, *td; /* literal, length, and distance tables */ +-unsigned bb, bl, bd; /* number of bits decoded by those */ +-unsigned bdl; /* number of distance low bits */ + /* Decompress the imploded data using coded literals and a sliding + window (of size 2^(6+bdl) bytes). */ ++static int explode_lit( ++ __GPRO__ ++ struct huft *tb, ++ struct huft *tl, ++ struct huft *td, /* literal, length, and distance tables */ ++ unsigned bb, ++ unsigned bl, ++ unsigned bd, /* number of bits decoded by those */ ++ unsigned bdl /* number of distance low bits */ ++) + { + zusz_t s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ +@@ -368,13 +374,16 @@ unsigned bdl; /* number of distance low bits */ + + + +-static int explode_nolit(__G__ tl, td, bl, bd, bdl) +- __GDEF +-struct huft *tl, *td; /* length and distance decoder tables */ +-unsigned bl, bd; /* number of bits decoded by tl[] and td[] */ +-unsigned bdl; /* number of distance low bits */ + /* Decompress the imploded data using uncoded literals and a sliding + window (of size 2^(6+bdl) bytes). */ ++static int explode_nolit( ++ __GPRO__ ++ struct huft *tl, ++ struct huft *td, /* length and distance decoder tables */ ++ unsigned bl, ++ unsigned bd, /* number of bits decoded by tl[] and td[] */ ++ unsigned bdl /* number of distance low bits */ ++) + { + zusz_t s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ +diff --git a/extract.c b/extract.c +index 6712ed0..114f6c5 100644 +--- a/extract.c ++++ b/extract.c +@@ -346,9 +346,7 @@ typedef struct { + * Return the index of the first span in cover whose beg is greater than val. + * If there is no such span, then cover->num is returned. + */ +-static size_t cover_find(cover, val) +- cover_t *cover; +- bound_t val; ++static size_t cover_find(cover_t *cover, bound_t val) + { + size_t lo = 0, hi = cover->num; + while (lo < hi) { +@@ -362,9 +360,7 @@ static size_t cover_find(cover, val) + } + + /* Return true if val lies within any one of the spans in cover. */ +-static int cover_within(cover, val) +- cover_t *cover; +- bound_t val; ++static int cover_within(cover_t *cover, bound_t val) + { + size_t pos = cover_find(cover, val); + return pos > 0 && val < cover->span[pos - 1].end; +@@ -382,10 +378,7 @@ static int cover_within(cover, val) + * end, then -1 is returned. If the list needs to be grown but the memory + * allocation fails, then -2 is returned. + */ +-static int cover_add(cover, beg, end) +- cover_t *cover; +- bound_t beg; +- bound_t end; ++static int cover_add(cover_t *cover, bound_t beg, bound_t end) + { + size_t pos; + int prec, foll; +@@ -449,8 +442,8 @@ static int cover_add(cover, beg, end) + /* Function extract_or_test_files() */ + /**************************************/ + +-int extract_or_test_files(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++int extract_or_test_files(__GPRO) + { + unsigned i, j; + zoff_t cd_bufstart; +@@ -975,8 +968,8 @@ int extract_or_test_files(__G) /* return PK-type error code */ + /* Function store_info() */ + /***************************/ + +-static int store_info(__G) /* return 0 if skipping, 1 if OK */ +- __GDEF ++/* return 0 if skipping, 1 if OK */ ++static int store_info(__GPRO) + { + #ifdef USE_BZIP2 + # define UNKN_BZ2 (G.crec.compression_method!=BZIPPED) +@@ -1152,8 +1145,7 @@ static int store_info(__G) /* return 0 if skipping, 1 if OK */ + /* Function find_compr_idx() */ + /*******************************/ + +-unsigned find_compr_idx(compr_methodnum) +- unsigned compr_methodnum; ++unsigned find_compr_idx(unsigned compr_methodnum) + { + unsigned i; + +@@ -1172,22 +1164,19 @@ unsigned find_compr_idx(compr_methodnum) + /* Function extract_or_test_entrylist() */ + /******************************************/ + +-static int extract_or_test_entrylist(__G__ numchunk, +- pfilnum, pnum_bad_pwd, pold_extra_bytes, +-#ifdef SET_DIR_ATTRIB +- pnum_dirs, pdirlist, +-#endif +- error_in_archive) /* return PK-type error code */ +- __GDEF +- unsigned numchunk; +- ulg *pfilnum; +- ulg *pnum_bad_pwd; +- zoff_t *pold_extra_bytes; ++/* return PK-type error code */ ++static int extract_or_test_entrylist( ++ __GPRO__ ++ unsigned numchunk, ++ ulg *pfilnum, ++ ulg *pnum_bad_pwd, ++ zoff_t *pold_extra_bytes, + #ifdef SET_DIR_ATTRIB +- unsigned *pnum_dirs; +- direntry **pdirlist; ++ unsigned *pnum_dirs, ++ direntry **pdirlist, + #endif +- int error_in_archive; ++ int error_in_archive ++) + { + unsigned i; + int renamed, query; +@@ -1799,8 +1788,8 @@ reprompt: + /* Function extract_or_test_member() */ + /***************************************/ + +-static int extract_or_test_member(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++static int extract_or_test_member(__GPRO) + { + char *nul="[empty] ", *txt="[text] ", *bin="[binary]"; + #ifdef CMS_MVS +@@ -2218,10 +2207,7 @@ static int extract_or_test_member(__G) /* return PK-type error code */ + /* Function TestExtraField() */ + /*******************************/ + +-static int TestExtraField(__G__ ef, ef_len) +- __GDEF +- uch *ef; +- unsigned ef_len; ++static int TestExtraField(__GPRO__ uch *ef, unsigned ef_len) + { + ush ebID; + unsigned ebLen; +@@ -2418,22 +2404,14 @@ static int TestExtraField(__G__ ef, ef_len) + /* Function test_compr_eb() */ + /******************************/ + +-#ifdef PROTO + static int test_compr_eb( + __GPRO__ + uch *eb, + unsigned eb_size, + unsigned compr_offset, + int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size, +- uch *eb_ucptr, ulg eb_ucsize)) +-#else /* !PROTO */ +-static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) +- __GDEF +- uch *eb; +- unsigned eb_size; +- unsigned compr_offset; +- int (*test_uc_ebdata)(); +-#endif /* ?PROTO */ ++ uch *eb_ucptr, ulg eb_ucsize) ++) + { + ulg eb_ucsize; + uch *eb_ucptr; +@@ -2493,12 +2471,11 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + /* Function memextract() */ + /***************************/ + +-int memextract(__G__ tgt, tgtsize, src, srcsize) /* extract compressed */ +- __GDEF /* extra field block; */ +- uch *tgt; /* return PK-type error */ +- ulg tgtsize; /* level */ +- ZCONST uch *src; +- ulg srcsize; ++/* extract compressed */ ++/* extra field block; */ ++/* return PK-type error */ ++/* level */ ++int memextract(__GPRO__ uch *tgt, ulg tgtsize, ZCONST uch *src, ulg srcsize) + { + zoff_t old_csize=G.csize; + uch *old_inptr=G.inptr; +@@ -2582,10 +2559,7 @@ int memextract(__G__ tgt, tgtsize, src, srcsize) /* extract compressed */ + /* Function memflush() */ + /*************************/ + +-int memflush(__G__ rawbuf, size) +- __GDEF +- ZCONST uch *rawbuf; +- ulg size; ++int memflush(__GPRO__ ZCONST uch *rawbuf, ulg size) + { + if (size > G.outsize) + /* Here, PK_DISK is a bit off-topic, but in the sense of marking +@@ -2622,13 +2596,7 @@ int memflush(__G__ rawbuf, size) + * - Deflation (see memextract()) + * The IZVMS block data is returned in malloc'd space. + */ +-uch *extract_izvms_block(__G__ ebdata, size, retlen, init, needlen) +- __GDEF +- ZCONST uch *ebdata; +- unsigned size; +- unsigned *retlen; +- ZCONST uch *init; +- unsigned needlen; ++uch *extract_izvms_block(__GPRO__ ZCONST uch *ebdata, unsigned size, unsigned *retlen, ZCONST uch *init, unsigned needlen) + { + uch *ucdata; /* Pointer to block allocated */ + int cmptype; +@@ -2684,10 +2652,11 @@ uch *extract_izvms_block(__G__ ebdata, size, retlen, init, needlen) + * else + * putbit(0) + */ +-static void decompress_bits(outptr, needlen, bitptr) +- uch *outptr; /* Pointer into output block */ +- unsigned needlen; /* Size of uncompressed block */ +- ZCONST uch *bitptr; /* Pointer into compressed data */ ++static void decompress_bits( ++ uch *outptr, /* Pointer into output block */ ++ unsigned needlen, /* Size of uncompressed block */ ++ ZCONST uch *bitptr /* Pointer into compressed data */ ++) + { + ulg bitbuf = 0; + int bitcnt = 0; +@@ -2730,9 +2699,7 @@ static void decompress_bits(outptr, needlen, bitptr) + /* Function set_deferred_symlink() */ + /***********************************/ + +-static void set_deferred_symlink(__G__ slnk_entry) +- __GDEF +- slinkentry *slnk_entry; ++static void set_deferred_symlink(__GPRO__ slinkentry *slnk_entry) + { + extent ucsize = slnk_entry->targetlen; + char *linkfname = slnk_entry->fname; +@@ -2787,10 +2754,8 @@ static void set_deferred_symlink(__G__ slnk_entry) + /* Function fnfilter() */ /* here instead of in list.c for SFX */ + /*************************/ + +-char *fnfilter(raw, space, size) /* convert name to safely printable form */ +- ZCONST char *raw; +- uch *space; +- extent size; ++/* convert name to safely printable form */ ++char *fnfilter(ZCONST char *raw, uch *space, extent size) + { + #ifndef NATIVE /* ASCII: filter ANSI escape codes, etc. */ + ZCONST uch *r=(ZCONST uch *)raw; +@@ -2913,8 +2878,8 @@ char *fnfilter(raw, space, size) /* convert name to safely printable form */ + /* Function dircomp() */ + /************************/ + +-static int Cdecl dircomp(a, b) /* used by qsort(); swiped from Zip */ +- ZCONST zvoid *a, *b; ++/* used by qsort(); swiped from Zip */ ++static int Cdecl dircomp(ZCONST zvoid *a, ZCONST zvoid *b) + { + /* order is significant: this sorts in reverse order (deepest first) */ + return strcmp((*(direntry **)b)->fn, (*(direntry **)a)->fn); +@@ -2930,9 +2895,8 @@ static int Cdecl dircomp(a, b) /* used by qsort(); swiped from Zip */ + /* Function UZbunzip2() */ + /**************************/ + +-int UZbunzip2(__G) +-__GDEF + /* decompress a bzipped entry using the libbz2 routines */ ++int UZbunzip2(__GPRO) + { + int retval = 0; /* return code: 0 = "no error" */ + int err=BZ_OK; +diff --git a/fileio.c b/fileio.c +index 50a74fc..dff4c73 100644 +--- a/fileio.c ++++ b/fileio.c +@@ -220,8 +220,8 @@ static ZCONST char Far ExtraFieldCorrupt[] = + /* Function open_input_file() */ + /******************************/ + +-int open_input_file(__G) /* return 1 if open failed */ +- __GDEF ++/* return 1 if open failed */ ++int open_input_file(__GPRO__) + { + /* + * open the zipfile for reading and in BINARY mode to prevent cr/lf +@@ -271,8 +271,8 @@ int open_input_file(__G) /* return 1 if open failed */ + /* Function open_outfile() */ + /***************************/ + +-int open_outfile(__G) /* return 1 if fail */ +- __GDEF ++/* return 1 if fail */ ++int open_outfile(__GPRO__) + { + #ifdef DLL + if (G.redirect_data) +@@ -524,8 +524,7 @@ int open_outfile(__G) /* return 1 if fail */ + /* function undefer_input() */ + /****************************/ + +-void undefer_input(__G) +- __GDEF ++void undefer_input(__GPRO__) + { + if (G.incnt > 0) + G.csize += G.incnt; +@@ -553,8 +552,7 @@ void undefer_input(__G) + /* function defer_leftover_input() */ + /***********************************/ + +-void defer_leftover_input(__G) +- __GDEF ++void defer_leftover_input(__GPRO__) + { + if ((zoff_t)G.incnt > G.csize) { + /* (G.csize < MAXINT), we can safely cast it to int !! */ +@@ -576,10 +574,8 @@ void defer_leftover_input(__G) + /* Function readbuf() */ + /**********************/ + +-unsigned readbuf(__G__ buf, size) /* return number of bytes read into buf */ +- __GDEF +- char *buf; +- register unsigned size; ++/* return number of bytes read into buf */ ++unsigned readbuf(__GPRO__ char *buf, register unsigned size) + { + register unsigned count; + unsigned n; +@@ -619,8 +615,8 @@ unsigned readbuf(__G__ buf, size) /* return number of bytes read into buf */ + /* Function readbyte() */ + /***********************/ + +-int readbyte(__G) /* refill inbuf and return a byte if available, else EOF */ +- __GDEF ++/* refill inbuf and return a byte if available, else EOF */ ++int readbyte(__GPRO) + { + if (G.mem_mode) + return EOF; +@@ -679,8 +675,8 @@ int readbyte(__G) /* refill inbuf and return a byte if available, else EOF */ + /* Function fillinbuf() */ + /************************/ + +-int fillinbuf(__G) /* like readbyte() except returns number of bytes in inbuf */ +- __GDEF ++/* like readbyte() except returns number of bytes in inbuf */ ++int fillinbuf(__GPRO) + { + if (G.mem_mode || + (G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) <= 0) +@@ -713,9 +709,7 @@ int fillinbuf(__G) /* like readbyte() except returns number of bytes in inbuf */ + /* Function seek_zipf() */ + /************************/ + +-int seek_zipf(__G__ abs_offset) +- __GDEF +- zoff_t abs_offset; ++int seek_zipf(__GPRO__ zoff_t abs_offset) + { + /* + * Seek to the block boundary of the block which includes abs_offset, +@@ -784,11 +778,7 @@ int seek_zipf(__G__ abs_offset) + /* Function flush() */ /* returns PK error codes: */ + /********************/ /* if tflag => always 0; PK_DISK if write error */ + +-int flush(__G__ rawbuf, size, unshrink) +- __GDEF +- uch *rawbuf; +- ulg size; +- int unshrink; ++int flush(__GPRO__ uch *rawbuf, ulg size, int unshrink) + #if (defined(USE_DEFLATE64) && defined(__16BIT__)) + { + int ret; +@@ -812,11 +802,12 @@ int flush(__G__ rawbuf, size, unshrink) + /* Function partflush() */ /* returns PK error codes: */ + /************************/ /* if tflag => always 0; PK_DISK if write error */ + +-static int partflush(__G__ rawbuf, size, unshrink) +- __GDEF +- uch *rawbuf; /* cannot be ZCONST, gets passed to (*G.message)() */ +- ulg size; +- int unshrink; ++static int partflush( ++ __GPRO__ ++ uch *rawbuf, /* cannot be ZCONST, gets passed to (*G.message)() */ ++ ulg size, ++ int unshrink ++) + #endif /* USE_DEFLATE64 && __16BIT__ */ + { + register uch *p; +@@ -1090,10 +1081,11 @@ static int partflush(__G__ rawbuf, size, unshrink) + /* Function is_vms_varlen_txt() */ + /********************************/ + +-static int is_vms_varlen_txt(__G__ ef_buf, ef_len) +- __GDEF +- uch *ef_buf; /* buffer containing extra field */ +- unsigned ef_len; /* total length of extra field */ ++static int is_vms_varlen_txt( ++ __GPRO__ ++ uch *ef_buf, /* buffer containing extra field */ ++ unsigned ef_len /* total length of extra field */ ++) + { + unsigned eb_id; + unsigned eb_len; +@@ -1216,8 +1208,7 @@ static int is_vms_varlen_txt(__G__ ef_buf, ef_len) + /* Function disk_error() */ + /*************************/ + +-static int disk_error(__G) +- __GDEF ++static int disk_error(__GPRO) + { + /* OK to use slide[] here because this file is finished regardless */ + Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery), +@@ -1245,11 +1236,12 @@ static int disk_error(__G) + /* Function UzpMessagePrnt() */ + /*****************************/ + +-int UZ_EXP UzpMessagePrnt(pG, buf, size, flag) +- zvoid *pG; /* globals struct: always passed */ +- uch *buf; /* preformatted string to be printed */ +- ulg size; /* length of string (may include nulls) */ +- int flag; /* flag bits */ ++int UZ_EXP UzpMessagePrnt( ++ zvoid *pG, /* globals struct: always passed */ ++ uch *buf, /* preformatted string to be printed */ ++ ulg size, /* length of string (may include nulls) */ ++ int flag /* flag bits */ ++) + { + /* IMPORTANT NOTE: + * The name of the first parameter of UzpMessagePrnt(), which passes +@@ -1488,11 +1480,12 @@ int UZ_EXP UzpMessageNull(pG, buf, size, flag) + /* Function UzpInput() */ /* GRR: this is a placeholder for now */ + /***********************/ + +-int UZ_EXP UzpInput(pG, buf, size, flag) +- zvoid *pG; /* globals struct: always passed */ +- uch *buf; /* preformatted string to be printed */ +- int *size; /* (address of) size of buf and of returned string */ +- int flag; /* flag bits (bit 0: no echo) */ ++int UZ_EXP UzpInput( ++ zvoid *pG, /* globals struct: always passed */ ++ uch *buf, /* preformatted string to be printed */ ++ int *size, /* (address of) size of buf and of returned string */ ++ int flag /* flag bits (bit 0: no echo) */ ++) + { + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; buf = buf; flag = flag; +@@ -1512,10 +1505,11 @@ int UZ_EXP UzpInput(pG, buf, size, flag) + /* Function UzpMorePause() */ + /***************************/ + +-void UZ_EXP UzpMorePause(pG, prompt, flag) +- zvoid *pG; /* globals struct: always passed */ +- ZCONST char *prompt; /* "--More--" prompt */ +- int flag; /* 0 = any char OK; 1 = accept only '\n', ' ', q */ ++void UZ_EXP UzpMorePause( ++ zvoid *pG, /* globals struct: always passed */ ++ ZCONST char *prompt, /* "--More--" prompt */ ++ int flag /* 0 = any char OK; 1 = accept only '\n', ' ', q */ ++) + { + uch c; + +@@ -1574,13 +1568,14 @@ void UZ_EXP UzpMorePause(pG, prompt, flag) + /* Function UzpPassword() */ + /**************************/ + +-int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) +- zvoid *pG; /* pointer to UnZip's internal global vars */ +- int *rcnt; /* retry counter */ +- char *pwbuf; /* buffer for password */ +- int size; /* size of password buffer */ +- ZCONST char *zfn; /* name of zip archive */ +- ZCONST char *efn; /* name of archive entry being processed */ ++int UZ_EXP UzpPassword( ++ zvoid *pG, /* pointer to UnZip's internal global vars */ ++ int *rcnt, /* retry counter */ ++ char *pwbuf, /* buffer for password */ ++ int size, /* size of password buffer */ ++ ZCONST char *zfn, /* name of zip archive */ ++ ZCONST char *efn /* name of archive entry being processed */ ++) + { + #if CRYPT + int r = IZ_PW_ENTERED; +@@ -1647,8 +1642,8 @@ int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) + /* Function handler() */ + /**********************/ + +-void handler(signal) /* upon interrupt, turn on echo and exit cleanly */ +- int signal; ++/* upon interrupt, turn on echo and exit cleanly */ ++void handler(int signal) + { + GETGLOBALS(); + +@@ -1711,8 +1706,7 @@ ZCONST ush ydays[] = + /* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */ + /*******************************/ + +-time_t dos_to_unix_time(dosdatetime) +- ulg dosdatetime; ++time_t dos_to_unix_time(ulg dosdatetime) + { + time_t m_time; + +@@ -1897,9 +1891,10 @@ time_t dos_to_unix_time(dosdatetime) + /* Function check_for_newer() */ /* used for overwriting/freshening/updating */ + /******************************/ + +-int check_for_newer(__G__ filename) /* return 1 if existing file is newer */ +- __GDEF /* or equal; 0 if older; -1 if doesn't */ +- char *filename; /* exist yet */ ++/* return 1 if existing file is newer */ ++/* or equal; 0 if older; -1 if doesn't */ ++/* exist yet */ ++int check_for_newer(__GPRO__ char *filename) + { + time_t existing, archive; + #ifdef USE_EF_UT_TIME +@@ -2016,10 +2011,12 @@ int check_for_newer(__G__ filename) /* return 1 if existing file is newer */ + /* Function do_string() */ + /************************/ + +-int do_string(__G__ length, option) /* return PK-type error code */ +- __GDEF +- unsigned int length; /* without prototype, ush converted to this */ +- int option; ++/* return PK-type error code */ ++int do_string( ++ __GPRO__ ++ unsigned int length, /* without prototype, ush converted to this */ ++ int option ++) + { + unsigned comment_bytes_left; + unsigned int block_len; +@@ -2446,8 +2443,7 @@ int do_string(__G__ length, option) /* return PK-type error code */ + /* Function makeword() */ + /***********************/ + +-ush makeword(b) +- ZCONST uch *b; ++ush makeword(ZCONST uch *b) + { + /* + * Convert Intel style 'short' integer to non-Intel non-16-bit +@@ -2464,8 +2460,7 @@ ush makeword(b) + /* Function makelong() */ + /***********************/ + +-ulg makelong(sig) +- ZCONST uch *sig; ++ulg makelong(ZCONST uch *sig) + { + /* + * Convert intel style 'long' variable to non-Intel non-16-bit +@@ -2485,8 +2480,7 @@ ulg makelong(sig) + /* Function makeint64() */ + /************************/ + +-zusz_t makeint64(sig) +- ZCONST uch *sig; ++zusz_t makeint64(ZCONST uch *sig) + { + #ifdef LARGE_FILE_SUPPORT + /* +@@ -2524,11 +2518,7 @@ zusz_t makeint64(sig) + /*********************/ + + /* Format a zoff_t value in a cylindrical buffer set. */ +-char *fzofft(__G__ val, pre, post) +- __GDEF +- zoff_t val; +- ZCONST char *pre; +- ZCONST char *post; ++char *fzofft(__GPRO__ zoff_t val, ZCONST char *pre, ZCONST char *post) + { + /* Storage cylinder. (now in globals.h) */ + /*static char fzofft_buf[FZOFFT_NUM][FZOFFT_LEN];*/ +@@ -2581,9 +2571,10 @@ char *fzofft(__G__ val, pre, post) + /* Function str2iso() */ + /**********************/ + +-char *str2iso(dst, src) +- char *dst; /* destination buffer */ +- register ZCONST char *src; /* source string */ ++char *str2iso( ++ char *dst, /* destination buffer */ ++ register ZCONST char *src /* source string */ ++) + { + #ifdef INTERN_TO_ISO + INTERN_TO_ISO(src, dst); +@@ -2607,9 +2598,10 @@ char *str2iso(dst, src) + /* Function str2oem() */ + /**********************/ + +-char *str2oem(dst, src) +- char *dst; /* destination buffer */ +- register ZCONST char *src; /* source string */ ++char *str2oem( ++ char *dst, /* destination buffer */ ++ register ZCONST char *src /* source string */ ++) + { + #ifdef INTERN_TO_OEM + INTERN_TO_OEM(src, dst); +@@ -2702,9 +2694,7 @@ zvoid *memcpy(dst, src, len) + /* Function zstrnicmp() */ + /************************/ + +-int zstrnicmp(s1, s2, n) +- register ZCONST char *s1, *s2; +- register unsigned n; ++int zstrnicmp(register ZCONST char *s1, register ZCONST char *s2, register unsigned n) + { + for (; n > 0; --n, ++s1, ++s2) { + +diff --git a/inflate.c b/inflate.c +index 2c37999..81bf089 100644 +--- a/inflate.c ++++ b/inflate.c +@@ -718,11 +718,7 @@ uzinflate_cleanup_exit: + + /* Function prototypes */ + #ifndef OF +-# ifdef __STDC__ +-# define OF(a) a +-# else +-# define OF(a) () +-# endif ++# define OF(a) a + #endif /* !OF */ + int inflate_codes OF((__GPRO__ struct huft *tl, struct huft *td, + unsigned bl, unsigned bd)); +@@ -929,12 +925,13 @@ static ZCONST unsigned dbits = 6; + + #ifndef ASM_INFLATECODES + +-int inflate_codes(__G__ tl, td, bl, bd) +- __GDEF +-struct huft *tl, *td; /* literal/length and distance decoder tables */ +-unsigned bl, bd; /* number of bits decoded by tl[] and td[] */ + /* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ ++int inflate_codes( ++ __GPRO__ ++ struct huft *tl, struct huft *td, /* literal/length and distance decoder tables */ ++ unsigned bl, unsigned bd /* number of bits decoded by tl[] and td[] */ ++) + { + register unsigned e; /* table entry flag/number of extra bits */ + unsigned d; /* index for copy */ +@@ -1383,10 +1380,11 @@ cleanup_and_exit: + + + +-static int inflate_block(__G__ e) +- __GDEF +- int *e; /* last block flag */ + /* decompress an inflated block */ ++static int inflate_block( ++ __GPRO__ ++ int *e /* last block flag */ ++) + { + unsigned t; /* block type */ + register ulg b; /* bit buffer */ +@@ -1434,10 +1432,8 @@ cleanup_and_exit: + + + +-int inflate(__G__ is_defl64) +- __GDEF +- int is_defl64; + /* decompress an inflated entry */ ++int inflate(__GPRO__ int is_defl64) + { + int e; /* last block flag */ + int r; /* result code */ +@@ -1548,15 +1544,6 @@ int inflate_free(__G) + #define N_MAX 288 /* maximum number of codes in any set */ + + +-int huft_build(__G__ b, n, s, d, e, t, m) +- __GDEF +- ZCONST unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ +- unsigned n; /* number of codes (assumed <= N_MAX) */ +- unsigned s; /* number of simple-valued codes (0..s-1) */ +- ZCONST ush *d; /* list of base values for non-simple codes */ +- ZCONST uch *e; /* list of extra bits for non-simple codes */ +- struct huft **t; /* result: starting table */ +- unsigned *m; /* maximum lookup bits, returns actual */ + /* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this +@@ -1565,6 +1552,16 @@ int huft_build(__G__ b, n, s, d, e, t, m) + The code with value 256 is special, and the tables are constructed + so that no bits beyond that code are fetched when that code is + decoded. */ ++int huft_build( ++ __GPRO__ ++ ZCONST unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ ++ unsigned n, /* number of codes (assumed <= N_MAX) */ ++ unsigned s, /* number of simple-valued codes (0..s-1) */ ++ ZCONST ush *d, /* list of base values for non-simple codes */ ++ ZCONST uch *e, /* list of extra bits for non-simple codes */ ++ struct huft **t, /* result: starting table */ ++ unsigned *m /* maximum lookup bits, returns actual */ ++) + { + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX+1]; /* bit length count table */ +@@ -1754,11 +1751,12 @@ int huft_build(__G__ b, n, s, d, e, t, m) + + + +-int huft_free(t) +-struct huft *t; /* table to free */ + /* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ ++int huft_free( ++ struct huft *t /* table to free */ ++) + { + register struct huft *p, *q; + +diff --git a/list.c b/list.c +index e488109..3454037 100644 +--- a/list.c ++++ b/list.c +@@ -562,10 +562,8 @@ static int fn_is_dir(__G) /* returns TRUE if G.filename is directory */ + /* Function get_time_stamp() */ + /*****************************/ + +-int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */ +- __GDEF +- time_t *last_modtime; +- ulg *nmember; ++/* return PK-type error code */ ++int get_time_stamp(__GPRO__ time_t *last_modtime, ulg *nmember) + { + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + ulg j; +@@ -705,8 +703,7 @@ int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */ + /* Function ratio() */ /* also used by ZipInfo routines */ + /********************/ + +-int ratio(uc, c) +- zusz_t uc, c; ++int ratio(zusz_t uc, zusz_t c) + { + zusz_t denom; + +diff --git a/match.c b/match.c +index f634409..0957576 100644 +--- a/match.c ++++ b/match.c +@@ -122,10 +122,7 @@ static int namecmp OF((ZCONST char *s1, ZCONST char *s2)); + + /* match() is a shell to recmatch() to return only Boolean values. */ + +-int match(string, pattern, ignore_case __WDL) +- ZCONST char *string, *pattern; +- int ignore_case; +- __WDLDEF ++int match(ZCONST char *string, ZCONST char *pattern, int ignore_case __WDLPRO) + { + #if (defined(MSDOS) && defined(DOSWILD)) + char *dospattern; +@@ -164,15 +161,16 @@ int match(string, pattern, ignore_case __WDL) + + + +-static int recmatch(p, s, ic __WDL) +- ZCONST uch *p; /* sh pattern to match */ +- ZCONST uch *s; /* string to which to match it */ +- int ic; /* true for case insensitivity */ +- __WDLDEF /* directory sepchar for WildStopAtDir mode, or 0 */ + /* Recursively compare the sh pattern p with the string s and return 1 if + * they match, and 0 or 2 if they don't or if there is a syntax error in the + * pattern. This routine recurses on itself no more deeply than the number + * of characters in the pattern. */ ++static int recmatch( ++ ZCONST uch *p, /* sh pattern to match */ ++ ZCONST uch *s, /* string to which to match it */ ++ int ic /* true for case insensitivity */ ++ __WDLPRO /* directory sepchar for WildStopAtDir mode, or 0 */ ++) + { + unsigned int c; /* pattern char or start of range in [-] loop */ + +@@ -340,8 +338,7 @@ static int recmatch(p, s, ic __WDL) + + + +-static char *isshexp(p) +-ZCONST char *p; ++static char *isshexp(ZCONST char *p) + /* If p is a sh expression, a pointer to the first special character is + returned. Otherwise, NULL is returned. */ + { +@@ -355,8 +352,7 @@ ZCONST char *p; + + + +-static int namecmp(s1, s2) +- ZCONST char *s1, *s2; ++static int namecmp(ZCONST char *s1, ZCONST char *s2) + { + int d; + +@@ -376,10 +372,11 @@ static int namecmp(s1, s2) + + + +- +-int iswild(p) /* originally only used for stat()-bug workaround in */ +- ZCONST char *p; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */ +-{ /* now used in process_zipfiles() as well */ ++/* originally only used for stat()-bug workaround in */ ++/* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */ ++/* now used in process_zipfiles() as well */ ++int iswild(ZCONST char *p) ++{ + for (; *p; INCSTR(p)) + if (*p == '\\' && *(p+1)) + ++p; +diff --git a/process.c b/process.c +index b385f1e..a4ec6a8 100644 +--- a/process.c ++++ b/process.c +@@ -233,8 +233,8 @@ static ZCONST char Far ZipfileCommTrunc1[] = + /* Function process_zipfiles() */ + /*******************************/ + +-int process_zipfiles(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++int process_zipfiles(__GPRO__) + { + #ifndef SFX + char *lastzipfn = (char *)NULL; +@@ -570,8 +570,8 @@ int process_zipfiles(__G) /* return PK-type error code */ + /* Function free_G_buffers() */ + /*****************************/ + +-void free_G_buffers(__G) /* releases all memory allocated in global vars */ +- __GDEF ++/* releases all memory allocated in global vars */ ++void free_G_buffers(__GPRO) + { + #ifndef SFX + unsigned i; +@@ -656,9 +656,8 @@ void free_G_buffers(__G) /* releases all memory allocated in global vars */ + /* Function do_seekable() */ + /**************************/ + +-static int do_seekable(__G__ lastchance) /* return PK-type error code */ +- __GDEF +- int lastchance; ++/* return PK-type error code */ ++static int do_seekable(__GPRO__ int lastchance) + { + #ifndef SFX + /* static int no_ecrec = FALSE; SKM: moved to globals.h */ +@@ -1042,14 +1041,12 @@ static int do_seekable(__G__ lastchance) /* return PK-type error code */ + The file has to be opened previously + */ + #ifdef USE_STRM_INPUT +-static zoff_t file_size(file) +- FILE *file; ++static zoff_t file_size(FILE *file) + { + int sts; + size_t siz; + #else /* !USE_STRM_INPUT */ +-static zoff_t file_size(fh) +- int fh; ++static zoff_t file_size(int fh) + { + int siz; + #endif /* ?USE_STRM_INPUT */ +@@ -1124,12 +1121,8 @@ static zoff_t file_size(fh) + /* Function rec_find() */ + /***********************/ + +-static int rec_find(__G__ searchlen, signature, rec_size) +- /* return 0 when rec found, 1 when not found, 2 in case of read error */ +- __GDEF +- zoff_t searchlen; +- char* signature; +- int rec_size; ++/* return 0 when rec found, 1 when not found, 2 in case of read error */ ++static int rec_find(__GPRO__ zoff_t searchlen, char *signature, int rec_size) + { + int i, numblks, found=FALSE; + zoff_t tail_len; +@@ -1207,8 +1200,7 @@ static int rec_find(__G__ searchlen, signature, rec_size) + /* Function check_ecrec_zip64() */ + /********************************/ + +-static int check_ecrec_zip64(__G) +- __GDEF ++static int check_ecrec_zip64(__GPRO) + { + return G.ecrec.offset_start_central_directory == 0xFFFFFFFFL + || G.ecrec.size_central_directory == 0xFFFFFFFFL +@@ -1225,9 +1217,8 @@ static int check_ecrec_zip64(__G) + /* Function find_ecrec64() */ + /***************************/ + +-static int find_ecrec64(__G__ searchlen) /* return PK-class error */ +- __GDEF +- zoff_t searchlen; ++/* return PK-class error */ ++static int find_ecrec64(__GPRO__ zoff_t searchlen) + { + ec_byte_rec64 byterec; /* buf for ecrec64 */ + ec_byte_loc64 byterecL; /* buf for ecrec64 locator */ +@@ -1455,9 +1446,8 @@ static int find_ecrec64(__G__ searchlen) /* return PK-class error */ + /* Function find_ecrec() */ + /*************************/ + +-static int find_ecrec(__G__ searchlen) /* return PK-class error */ +- __GDEF +- zoff_t searchlen; ++/* return PK-class error */ ++static int find_ecrec(__GPRO__ zoff_t searchlen) + { + int found = FALSE; + int error_in_archive; +@@ -1600,8 +1590,8 @@ static int find_ecrec(__G__ searchlen) /* return PK-class error */ + /* Function process_zip_cmmnt() */ + /********************************/ + +-static int process_zip_cmmnt(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++static int process_zip_cmmnt(__GPRO) + { + int error = PK_COOL; + +@@ -1703,8 +1693,8 @@ static int process_zip_cmmnt(__G) /* return PK-type error code */ + /* Function process_cdir_file_hdr() */ + /************************************/ + +-int process_cdir_file_hdr(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++int process_cdir_file_hdr(__GPRO) + { + int error; + +@@ -1791,8 +1781,8 @@ int process_cdir_file_hdr(__G) /* return PK-type error code */ + /* Function get_cdir_ent() */ + /***************************/ + +-static int get_cdir_ent(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++static int get_cdir_ent(__GPRO) + { + cdir_byte_hdr byterec; + +@@ -1853,8 +1843,8 @@ static int get_cdir_ent(__G) /* return PK-type error code */ + /* Function process_local_file_hdr() */ + /*************************************/ + +-int process_local_file_hdr(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++int process_local_file_hdr(__GPRO) + { + local_byte_hdr byterec; + +@@ -1902,10 +1892,11 @@ int process_local_file_hdr(__G) /* return PK-type error code */ + /* Function getZip64Data() */ + /*******************************/ + +-int getZip64Data(__G__ ef_buf, ef_len) +- __GDEF +- ZCONST uch *ef_buf; /* buffer containing extra field */ +- unsigned ef_len; /* total length of extra field */ ++int getZip64Data( ++ __GPRO__ ++ ZCONST uch *ef_buf, /* buffer containing extra field */ ++ unsigned ef_len /* total length of extra field */ ++) + { + unsigned eb_id; + unsigned eb_len; +@@ -2009,10 +2000,11 @@ int getZip64Data(__G__ ef_buf, ef_len) + /* Function getUnicodeData() */ + /*******************************/ + +-int getUnicodeData(__G__ ef_buf, ef_len) +- __GDEF +- ZCONST uch *ef_buf; /* buffer containing extra field */ +- unsigned ef_len; /* total length of extra field */ ++int getUnicodeData( ++ __GPRO__ ++ ZCONST uch *ef_buf, /* buffer containing extra field */ ++ unsigned ef_len /* total length of extra field */ ++) + { + unsigned eb_id; + unsigned eb_len; +@@ -2157,8 +2149,7 @@ static int utf8_to_ucs4_string OF((ZCONST char *utf8, ulg *ucs4buf, + * Returns the number of bytes used by the first character in a UTF-8 + * string, or -1 if the UTF-8 is invalid or null. + */ +-static int utf8_char_bytes(utf8) +- ZCONST char *utf8; ++static int utf8_char_bytes(ZCONST char *utf8) + { + int t, r; + unsigned lead; +@@ -2196,8 +2187,7 @@ static int utf8_char_bytes(utf8) + * Returns ~0 (= -1 in twos-complement notation) and does not advance the + * pointer when input is ill-formed. + */ +-static ulg ucs4_char_from_utf8(utf8) +- ZCONST char **utf8; ++static ulg ucs4_char_from_utf8(ZCONST char **utf8) + { + ulg ret; + int t, bytes; +@@ -2224,9 +2214,7 @@ static ulg ucs4_char_from_utf8(utf8) + * Returns the number of bytes put into utf8buf to represent ch, from 1 to 6, + * or -1 if ch is too large to represent. utf8buf must have room for 6 bytes. + */ +-static int utf8_from_ucs4_char(utf8buf, ch) +- char *utf8buf; +- ulg ch; ++static int utf8_from_ucs4_char(char *utf8buf, ulg ch) + { + int trailing = 0; + int leadmask = 0x80; +@@ -2264,10 +2252,7 @@ static int utf8_from_ucs4_char(utf8buf, ch) + * + * Return UCS count. Now returns int so can return -1. + */ +-static int utf8_to_ucs4_string(utf8, ucs4buf, buflen) +- ZCONST char *utf8; +- ulg *ucs4buf; +- int buflen; ++static int utf8_to_ucs4_string(ZCONST char *utf8, ulg *ucs4buf, int buflen) + { + int count = 0; + +@@ -2293,10 +2278,7 @@ static int utf8_to_ucs4_string(utf8, ucs4buf, buflen) + * + * + */ +-static int ucs4_string_to_utf8(ucs4, utf8buf, buflen) +- ZCONST ulg *ucs4; +- char *utf8buf; +- int buflen; ++static int ucs4_string_to_utf8(ZCONST ulg *ucs4, char *utf8buf, int buflen) + { + char mb[6]; + int count = 0; +@@ -2327,8 +2309,7 @@ static int ucs4_string_to_utf8(ucs4, utf8buf, buflen) + * + * Wrapper: counts the actual unicode characters in a UTF-8 string. + */ +-static int utf8_chars(utf8) +- ZCONST char *utf8; ++static int utf8_chars(ZCONST char *utf8) + { + return utf8_to_ucs4_string(utf8, NULL, 0); + } +@@ -2353,8 +2334,7 @@ static int utf8_chars(utf8) + /* is_ascii_string + * Checks if a string is all ascii + */ +-int is_ascii_string(mbstring) +- ZCONST char *mbstring; ++int is_ascii_string(ZCONST char *mbstring) + { + char *p; + uch c; +@@ -2368,8 +2348,7 @@ int is_ascii_string(mbstring) + } + + /* local to UTF-8 */ +-char *local_to_utf8_string(local_string) +- ZCONST char *local_string; ++char *local_to_utf8_string(ZCONST char *local_string) + { + return wide_to_utf8_string(local_to_wide_string(local_string)); + } +@@ -2408,8 +2387,7 @@ char *local_to_utf8_string(local_string) + /* set this to the max bytes an escape can be */ + #define MAX_ESCAPE_BYTES 8 + +-char *wide_to_escape_string(wide_char) +- zwchar wide_char; ++char *wide_to_escape_string(zwchar wide_char) + { + int i; + zwchar w = wide_char; +@@ -2447,8 +2425,7 @@ char *wide_to_escape_string(wide_char) + + #if 0 /* currently unused */ + /* returns the wide character represented by the escape string */ +-zwchar escape_string_to_wide(escape_string) +- ZCONST char *escape_string; ++zwchar escape_string_to_wide(ZCONST char *escape_string) + { + int i; + zwchar w; +@@ -2497,9 +2474,7 @@ zwchar escape_string_to_wide(escape_string) + + #ifndef WIN32 /* WIN32 supplies a special variant of this function */ + /* convert wide character string to multi-byte character string */ +-char *wide_to_local_string(wide_string, escape_all) +- ZCONST zwchar *wide_string; +- int escape_all; ++char *wide_to_local_string(ZCONST zwchar *wide_string, int escape_all) + { + int i; + wchar_t wc; +@@ -2591,8 +2566,7 @@ char *wide_to_local_string(wide_string, escape_all) + + #if 0 /* currently unused */ + /* convert local string to display character set string */ +-char *local_to_display_string(local_string) +- ZCONST char *local_string; ++char *local_to_display_string(ZCONST char *local_string) + { + char *display_string; + +@@ -2624,9 +2598,7 @@ char *local_to_display_string(local_string) + #endif /* unused */ + + /* UTF-8 to local */ +-char *utf8_to_local_string(utf8_string, escape_all) +- ZCONST char *utf8_string; +- int escape_all; ++char *utf8_to_local_string(ZCONST char *utf8_string, int escape_all) + { + zwchar *wide; + char *loc = NULL; +@@ -2645,8 +2617,7 @@ char *utf8_to_local_string(utf8_string, escape_all) + + #if 0 /* currently unused */ + /* convert multi-byte character string to wide character string */ +-zwchar *local_to_wide_string(local_string) +- ZCONST char *local_string; ++zwchar *local_to_wide_string(ZCONST char *local_string) + { + int wsize; + wchar_t *wc_string; +@@ -2679,8 +2650,7 @@ zwchar *local_to_wide_string(local_string) + + + /* convert wide string to UTF-8 */ +-char *wide_to_utf8_string(wide_string) +- ZCONST zwchar *wide_string; ++char *wide_to_utf8_string(ZCONST zwchar *wide_string) + { + int mbcount; + char *utf8_string; +@@ -2701,8 +2671,7 @@ char *wide_to_utf8_string(wide_string) + #endif /* unused */ + + /* convert UTF-8 string to wide string */ +-zwchar *utf8_to_wide_string(utf8_string) +- ZCONST char *utf8_string; ++zwchar *utf8_to_wide_string(ZCONST char *utf8_string) + { + int wcount; + zwchar *wide_string; +@@ -2729,10 +2698,11 @@ zwchar *utf8_to_wide_string(utf8_string) + #ifdef USE_EF_UT_TIME + + #ifdef IZ_HAVE_UXUIDGID +-static int read_ux3_value(dbuf, uidgid_sz, p_uidgid) +- ZCONST uch *dbuf; /* buffer a uid or gid value */ +- unsigned uidgid_sz; /* size of uid/gid value */ +- ulg *p_uidgid; /* return storage: uid or gid value */ ++static int read_ux3_value( ++ ZCONST uch *dbuf, /* buffer a uid or gid value */ ++ unsigned uidgid_sz, /* size of uid/gid value */ ++ ulg *p_uidgid /* return storage: uid or gid value */ ++) + { + zusz_t uidgid64; + +@@ -2763,14 +2733,14 @@ static int read_ux3_value(dbuf, uidgid_sz, p_uidgid) + /* Function ef_scan_for_izux() */ + /*******************************/ + +-unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, +- z_utim, z_uidgid) +- ZCONST uch *ef_buf; /* buffer containing extra field */ +- unsigned ef_len; /* total length of extra field */ +- int ef_is_c; /* flag indicating "is central extra field" */ +- ulg dos_mdatetime; /* last_mod_file_date_time in DOS format */ +- iztimes *z_utim; /* return storage: atime, mtime, ctime */ +- ulg *z_uidgid; /* return storage: uid and gid */ ++unsigned ef_scan_for_izux( ++ ZCONST uch *ef_buf, /* buffer containing extra field */ ++ unsigned ef_len, /* total length of extra field */ ++ int ef_is_c, /* flag indicating "is central extra field" */ ++ ulg dos_mdatetime, /* last_mod_file_date_time in DOS format */ ++ iztimes *z_utim, /* return storage: atime, mtime, ctime */ ++ ulg *z_uidgid /* return storage: uid and gid */ ++) + { + unsigned flags = 0; + unsigned eb_id; +@@ -3138,9 +3108,10 @@ unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + /* Function getRISCOSexfield() */ + /*******************************/ + +-zvoid *getRISCOSexfield(ef_buf, ef_len) +- ZCONST uch *ef_buf; /* buffer containing extra field */ +- unsigned ef_len; /* total length of extra field */ ++zvoid *getRISCOSexfield( ++ ZCONST uch *ef_buf, /* buffer containing extra field */ ++ unsigned ef_len /* total length of extra field */ ++) + { + unsigned eb_id; + unsigned eb_len; +diff --git a/ttyio.c b/ttyio.c +index a1a13b1..f71e97f 100644 +--- a/ttyio.c ++++ b/ttyio.c +@@ -303,9 +303,10 @@ int tt_getch() + /* + * Turn echo off for file descriptor f. Assumes that f is a tty device. + */ +-void Echoff(__G__ f) +- __GDEF +- int f; /* file descriptor for which to turn echo off */ ++void Echoff( ++ __GPRO__ ++ int f /* file descriptor for which to turn echo off */ ++) + { + struct sgttyb sg; /* tty device structure */ + +@@ -318,8 +319,7 @@ void Echoff(__G__ f) + /* + * Turn echo back on for file descriptor echofd. + */ +-void Echon(__G) +- __GDEF ++void Echon(__GPRO) + { + struct sgttyb sg; /* tty device structure */ + +@@ -350,9 +350,7 @@ void Echon(__G) + + #if (defined(TIOCGWINSZ) && !defined(M_UNIX)) + +-int screensize(tt_rows, tt_cols) +- int *tt_rows; +- int *tt_cols; ++int screensize(int *tt_rows, int *tt_cols) + { + struct winsize wsz; + #ifdef DEBUG_WINSZ +@@ -436,9 +434,10 @@ int screensize(tt_rows, tt_cols) + /* + * Get a character from the given file descriptor without echo or newline. + */ +-int zgetch(__G__ f) +- __GDEF +- int f; /* file descriptor from which to read */ ++int zgetch( ++ __GPRO__ ++ int f /* file descriptor from which to read */ ++) + { + #if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + char oldmin, oldtim; +@@ -481,9 +480,10 @@ int zgetch(__G__ f) + #ifndef VMS /* VMS supplies its own variant of getch() */ + + +-int zgetch(__G__ f) +- __GDEF +- int f; /* file descriptor from which to read (must be open already) */ ++int zgetch( ++ __GPRO__ ++ int f /* file descriptor from which to read (must be open already) */ ++) + { + char c, c2; + +@@ -547,11 +547,12 @@ int zgetch(__G__ f) + /* This is the getp() function for all systems (with TTY type user interface) + * that supply a working `non-echo' getch() function for "raw" console input. + */ +-char *getp(__G__ m, p, n) +- __GDEF +- ZCONST char *m; /* prompt for password */ +- char *p; /* return value: line input */ +- int n; /* bytes available in p[] */ ++char *getp( ++ __GPRO__ ++ ZCONST char *m, /* prompt for password */ ++ char *p, /* return value: line input */ ++ int n /* bytes available in p[] */ ++) + { + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ +@@ -599,11 +600,12 @@ char *getp(__G__ m, p, n) + # endif + #endif + +-char *getp(__G__ m, p, n) +- __GDEF +- ZCONST char *m; /* prompt for password */ +- char *p; /* return value: line input */ +- int n; /* bytes available in p[] */ ++char *getp( ++ __GPRO__ ++ ZCONST char *m, /* prompt for password */ ++ char *p, /* return value: line input */ ++ int n /* bytes available in p[] */ ++) + { + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ +@@ -652,11 +654,11 @@ char *getp(__G__ m, p, n) + + #if (defined(VMS) || defined(CMS_MVS)) + +-char *getp(__G__ m, p, n) +- __GDEF +- ZCONST char *m; /* prompt for password */ +- char *p; /* return value: line input */ +- int n; /* bytes available in p[] */ ++char *getp( ++ __GPRO__ ++ ZCONST char *m, /* prompt for password */ ++ char *p, /* return value: line input */ ++ int n /* bytes available in p[] */ + { + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ +diff --git a/ubz2err.c b/ubz2err.c +index f384489..5293b1f 100644 +--- a/ubz2err.c ++++ b/ubz2err.c +@@ -45,8 +45,7 @@ + * BZ_NO_STDIO), required to handle fatal internal bug-type errors of + * the bzip2 library. + */ +-void bz_internal_error(bzerrcode) +- int bzerrcode; ++void bz_internal_error(int bzerrcode) + { + GETGLOBALS(); + +diff --git a/unix/configure b/unix/configure +index 785d8dd..dffebcf 100755 +--- a/unix/configure ++++ b/unix/configure +@@ -189,11 +189,6 @@ if [ $? -ne 0 ]; then + done + fi + +-echo Check for prototypes +-echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c +-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_PROTO" +- + # const check currently handles mips cc and non ANSI compilers. + # does it need more ? + echo Check the handling of const +diff --git a/unix/unix.c b/unix/unix.c +index 816e3da..9d14cdf 100644 +--- a/unix/unix.c ++++ b/unix/unix.c +@@ -186,9 +186,8 @@ struct dirent *readdir(dirp) + /* Function do_wild() */ /* for porting: dir separator; match(ignore_case) */ + /**********************/ + +-char *do_wild(__G__ wildspec) +- __GDEF +- ZCONST char *wildspec; /* only used first time on a given dir */ ++/* only used first time on a given dir */ ++char *do_wild(__GPRO__ ZCONST char *wildspec) + { + /* these statics are now declared in SYSTEM_SPECIFIC_GLOBALS in unxcfg.h: + static DIR *wild_dir = (DIR *)NULL; +@@ -328,9 +327,7 @@ char *do_wild(__G__ wildspec) + * file as the user or group. The new option -K bypasses this check. + */ + +-static unsigned filtattr(__G__ perms) +- __GDEF +- unsigned perms; ++static unsigned filtattr(__GPRO__ unsigned perms) + { + /* keep setuid/setgid/tacky perms? */ + if (!uO.K_flag) +@@ -347,8 +344,7 @@ static unsigned filtattr(__G__ perms) + /* Function mapattr() */ + /**********************/ + +-int mapattr(__G) +- __GDEF ++int mapattr(__GPRO) + { + int r; + ulg tmp = G.crec.external_file_attributes; +@@ -495,9 +491,6 @@ int mapattr(__G) + /* Function mapname() */ + /************************/ + +-int mapname(__G__ renamed) +- __GDEF +- int renamed; + /* + * returns: + * MPN_OK - no problem detected +@@ -508,6 +501,7 @@ int mapname(__G__ renamed) + * MPN_NOMEM - error (memory allocation failed) -> skip entry + * [also MPN_VOL_LABEL, MPN_CREATED_DIR] + */ ++int mapname(__GPRO__ int renamed) + { + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=(char *)NULL; /* character pointers */ +@@ -748,10 +742,6 @@ int mapname(__G__ renamed) + /* Function checkdir() */ + /***********************/ + +-int checkdir(__G__ pathcomp, flag) +- __GDEF +- char *pathcomp; +- int flag; + /* + * returns: + * MPN_OK - no problem detected +@@ -762,6 +752,7 @@ int checkdir(__G__ pathcomp, flag) + * MPN_ERR_TOOLONG - path is too long + * MPN_NOMEM - can't allocate memory for filename buffers + */ ++int checkdir(__GPRO__ char *pathcomp, int flag) + { + /* static int rootlen = 0; */ /* length of rootpath */ + /* static char *rootpath; */ /* user's "extract-to" directory */ +@@ -1039,12 +1030,7 @@ int mkdir(path, mode) + + + #if (!defined(MTS) || defined(SET_DIR_ATTRIB)) +-static int get_extattribs OF((__GPRO__ iztimes *pzt, ulg z_uidgid[2])); +- +-static int get_extattribs(__G__ pzt, z_uidgid) +- __GDEF +- iztimes *pzt; +- ulg z_uidgid[2]; ++static int get_extattribs(__GPRO__ iztimes *pzt, ulg z_uidgid[2]) + { + /*--------------------------------------------------------------------------- + Convert from MSDOS-format local time and date to Unix-format 32-bit GMT +@@ -1099,8 +1085,8 @@ static int get_extattribs(__G__ pzt, z_uidgid) + /* Function close_outfile() */ + /****************************/ + +-void close_outfile(__G) /* GRR: change to return PK-style warning level */ +- __GDEF ++/* GRR: change to return PK-style warning level */ ++void close_outfile(__GPRO) + { + union { + iztimes t3; /* mtime, atime, ctime */ +@@ -1273,9 +1259,7 @@ void close_outfile(__G) /* GRR: change to return PK-style warning level */ + + + #if (defined(SYMLINKS) && defined(SET_SYMLINK_ATTRIBS)) +-int set_symlnk_attribs(__G__ slnk_entry) +- __GDEF +- slinkentry *slnk_entry; ++int set_symlnk_attribs(__GPRO__ slinkentry *slnk_entry) + { + if (slnk_entry->attriblen > 0) { + # if (!defined(NO_LCHOWN)) +@@ -1321,9 +1305,7 @@ int set_symlnk_attribs(__G__ slnk_entry) + # endif + + +-int defer_dir_attribs(__G__ pd) +- __GDEF +- direntry **pd; ++int defer_dir_attribs(__GPRO__ direntry **pd) + { + uxdirattr *d_entry; + +@@ -1343,9 +1325,7 @@ int defer_dir_attribs(__G__ pd) + } /* end function defer_dir_attribs() */ + + +-int set_direc_attribs(__G__ d) +- __GDEF +- direntry *d; ++int set_direc_attribs(__GPRO__ direntry *d) + { + int errval = PK_OK; + +@@ -1394,9 +1374,7 @@ int set_direc_attribs(__G__ d) + /* Function stamp_file() */ + /***************************/ + +-int stamp_file(fname, modtime) +- ZCONST char *fname; +- time_t modtime; ++int stamp_file(ZCONST char *fname, time_t modtime) + { + ztimbuf tp; + +@@ -1416,8 +1394,7 @@ int stamp_file(fname, modtime) + /* Function version() */ + /************************/ + +-void version(__G) +- __GDEF ++void version(__GPRO) + { + #if (defined(__GNUC__) && defined(NX_CURRENT_COMPILER_RELEASE)) + char cc_namebuf[40]; +@@ -1784,10 +1761,7 @@ static ulg LG(ulg val) + + + +-static void qlfix(__G__ ef_ptr, ef_len) +- __GDEF +- uch *ef_ptr; +- unsigned ef_len; ++static void qlfix(__GPRO__ uch *ef_ptr, unsigned ef_len) + { + while (ef_len >= EB_HEADSIZE) + { +diff --git a/unshrink.c b/unshrink.c +index ae993e9..2c3e781 100644 +--- a/unshrink.c ++++ b/unshrink.c +@@ -97,8 +97,7 @@ static void partial_clear OF((__GPRO__ int lastcodeused)); + /* Function unshrink() */ + /***********************/ + +-int unshrink(__G) +- __GDEF ++int unshrink(__GPRO) + { + uch *stacktop = stack + (HSIZE - 1); + register uch *newstr; +@@ -304,9 +303,7 @@ int unshrink(__G) + /* Function partial_clear() */ /* no longer recursive... */ + /****************************/ + +-static void partial_clear(__G__ lastcodeused) +- __GDEF +- int lastcodeused; ++static void partial_clear(__GPRO__ int lastcodeused) + { + register shrint code; + +diff --git a/unzip.c b/unzip.c +index 1abaccb..9a2cf60 100644 +--- a/unzip.c ++++ b/unzip.c +@@ -710,9 +710,8 @@ See \"unzip -hh\" or unzip.txt for more help. Examples:\n\ + /* main() / UzpMain() stub */ + /*****************************/ + +-int MAIN(argc, argv) /* return PK-type error code (except under VMS) */ +- int argc; +- char *argv[]; ++/* return PK-type error code (except under VMS) */ ++int MAIN(int argc, char *argv[]) + { + int r; + +@@ -729,10 +728,7 @@ int MAIN(argc, argv) /* return PK-type error code (except under VMS) */ + /* Primary UnZip entry point */ + /*******************************/ + +-int unzip(__G__ argc, argv) +- __GDEF +- int argc; +- char *argv[]; ++int unzip(__GPRO__ int argc, char *argv[]) + { + #ifndef NO_ZIPINFO + char *p; +@@ -1286,12 +1282,8 @@ cleanup_and_exit: + /* Function setsignalhandler() */ + /*******************************/ + +-static int setsignalhandler(__G__ p_savedhandler_chain, signal_type, +- newhandler) +- __GDEF +- savsigs_info **p_savedhandler_chain; +- int signal_type; +- void (*newhandler)(int); ++static int setsignalhandler(__GPRO__ savsigs_info **p_savedhandler_chain, int signal_type, ++ void (*newhandler)(int)) + { + savsigs_info *savsig; + +@@ -1323,10 +1315,7 @@ static int setsignalhandler(__G__ p_savedhandler_chain, signal_type, + /* Function uz_opts() */ + /**********************/ + +-int uz_opts(__G__ pargc, pargv) +- __GDEF +- int *pargc; +- char ***pargv; ++int uz_opts(__GPRO__ int *pargc, char ***pargv) + { + char **argv, *s; + int argc, c, error=FALSE, negative=0, showhelp=0; +@@ -1971,9 +1960,8 @@ opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */ + # endif + # endif + +-int usage(__G__ error) /* return PK-type error code */ +- __GDEF +- int error; ++/* return PK-type error code */ ++int usage(__GPRO__ int error) + { + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), + UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, +@@ -2005,9 +1993,8 @@ int usage(__G__ error) /* return PK-type error code */ + # define QUOTS "" + # endif + +-int usage(__G__ error) /* return PK-type error code */ +- __GDEF +- int error; ++/* return PK-type error code */ ++int usage(__GPRO__ int error) + { + int flag = (error? 1 : 0); + +@@ -2082,8 +2069,7 @@ You must quote non-lowercase options and filespecs, unless SET PROC/PARSE=EXT.\ + #ifndef SFX + + /* Print extended help to stdout. */ +-static void help_extended(__G) +- __GDEF ++static void help_extended(__GPRO) + { + extent i; /* counter for help array */ + +@@ -2332,8 +2318,7 @@ extern char *getenv(); + /* Function show_version_info() */ + /********************************/ + +-static void show_version_info(__G) +- __GDEF ++static void show_version_info(__GPRO) + { + if (uO.qflag > 3) /* "unzip -vqqqq" */ + Info(slide, 0, ((char *)slide, "%d\n", +diff --git a/unzip.h b/unzip.h +index ed24a5b..9891467 100644 +--- a/unzip.h ++++ b/unzip.h +@@ -211,51 +211,33 @@ freely, subject to the above disclaimer and the following restrictions: + * or Convex?, or AtheOS, or BeOS. + */ + #if (defined(__STDC__) || defined(MSDOS) || defined(OS2) || defined(WIN32)) +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif + #endif + #if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__)) +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif + #endif + #if (defined(__EMX__) || defined(__CYGWIN__)) +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif + #endif + #if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS) || defined(THEOS)) +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif + #endif + /* Sequent running Dynix/ptx: non-modern compiler */ + #if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX))) +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif + #endif + #if (defined(CMS_MVS) || defined(__ATHEOS__) || defined(__BEOS__)) + /* || defined(CONVEX) ? */ +-# ifndef PROTO +-# define PROTO +-# endif + # ifndef MODERN + # define MODERN + # endif +@@ -267,17 +249,7 @@ freely, subject to the above disclaimer and the following restrictions: + # endif + #endif + +-/* turn off prototypes if requested */ +-#if (defined(NOPROTO) && defined(PROTO)) +-# undef PROTO +-#endif +- +-/* used to remove arguments in function prototypes for non-ANSI C */ +-#ifdef PROTO +-# define OF(a) a +-#else +-# define OF(a) () +-#endif ++#define OF(a) a + + /* enable the "const" keyword only if MODERN and if not otherwise instructed */ + #ifdef MODERN +@@ -405,24 +377,15 @@ typedef unsigned long ulg; /* predefined on some systems) & match zip */ + #endif /* !_IZ_TYPES_DEFINED */ + + /* InputFn is not yet used and is likely to change: */ +-#ifdef PROTO +- typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag); +- typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag); +- typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag); +- typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf, +- int size, ZCONST char *zfn, +- ZCONST char *efn); +- typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn, +- ZCONST char *efn, ZCONST zvoid *details); +- typedef void (UZ_EXP UsrIniFn) (void); +-#else /* !PROTO */ +- typedef int (UZ_EXP MsgFn) (); +- typedef int (UZ_EXP InputFn) (); +- typedef void (UZ_EXP PauseFn) (); +- typedef int (UZ_EXP PasswdFn) (); +- typedef int (UZ_EXP StatCBFn) (); +- typedef void (UZ_EXP UsrIniFn) (); +-#endif /* ?PROTO */ ++typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag); ++typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag); ++typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag); ++typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf, ++ int size, ZCONST char *zfn, ++ ZCONST char *efn); ++typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn, ++ ZCONST char *efn, ZCONST zvoid *details); ++typedef void (UZ_EXP UsrIniFn) (void); + + typedef struct _UzpBuffer { /* rxstr */ + ulg strlength; /* length of string */ +diff --git a/zipinfo.c b/zipinfo.c +index 0be3e5b..94d5430 100644 +--- a/zipinfo.c ++++ b/zipinfo.c +@@ -446,10 +446,7 @@ static ZCONST char Far DecimalTime[] = "%04u%02u%02u.%02u%02u%02u"; + /* Function zi_opts() */ + /************************/ + +-int zi_opts(__G__ pargc, pargv) +- int *pargc; +- char ***pargv; +- __GDEF ++int zi_opts(__GPRO__ int *pargc, char ***pargv) + { + char **argv, *s; + int argc, c, error=FALSE, negative=0; +@@ -635,8 +632,7 @@ int zi_opts(__G__ pargc, pargv) + /* Function zi_end_central() */ + /*******************************/ + +-void zi_end_central(__G) +- __GDEF ++void zi_end_central(__GPRO) + { + /*--------------------------------------------------------------------------- + Print out various interesting things about the zipfile. +@@ -702,8 +698,8 @@ void zi_end_central(__G) + /* Function zipinfo() */ + /************************/ + +-int zipinfo(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++int zipinfo(__GPRO) + { + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + int *fn_matched=NULL, *xn_matched=NULL; +@@ -984,11 +980,12 @@ int zipinfo(__G) /* return PK-type error code */ + /* Function zi_long() */ + /************************/ + +-static int zi_long(__G__ pEndprev, error_in_archive) +- /* return PK-type error code */ +- __GDEF +- zusz_t *pEndprev; /* for zi_long() check of extra bytes */ +- int error_in_archive; /* may signal premature return */ ++/* return PK-type error code */ ++static int zi_long( ++ __GPRO__ ++ zusz_t *pEndprev, /* for zi_long() check of extra bytes */ ++ int error_in_archive /* may signal premature return */ ++) + { + #ifdef USE_EF_UT_TIME + iztimes z_utime; +@@ -1872,8 +1869,8 @@ ef_default_display: + /* Function zi_short() */ + /*************************/ + +-static int zi_short(__G) /* return PK-type error code */ +- __GDEF ++/* return PK-type error code */ ++static int zi_short(__GPRO) + { + #ifdef USE_EF_UT_TIME + iztimes z_utime; +@@ -2207,9 +2204,7 @@ static int zi_short(__G) /* return PK-type error code */ + /* Function zi_showMacTypeCreator() */ + /**************************************/ + +-static void zi_showMacTypeCreator(__G__ ebfield) +- __GDEF +- uch *ebfield; ++static void zi_showMacTypeCreator(__GPRO__ uch *ebfield) + { + /* not every Type / Creator character is printable */ + if (isprint(native(ebfield[0])) && isprint(native(ebfield[1])) && +@@ -2242,11 +2237,7 @@ static void zi_showMacTypeCreator(__G__ ebfield) + /* Function zi_time() */ + /************************/ + +-static char *zi_time(__G__ datetimez, modtimez, d_t_str) +- __GDEF +- ZCONST ulg *datetimez; +- ZCONST time_t *modtimez; +- char *d_t_str; ++static char *zi_time(__GPRO__ ZCONST ulg *datetimez, ZCONST time_t *modtimez, char *d_t_str) + { + unsigned yr, mo, dy, hh, mm, ss; + char monthbuf[4]; +-- +2.49.0 + diff --git a/pkg/unzip/sha256 b/pkg/unzip/sha256 @@ -0,0 +1 @@ +036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 unzip60.tar.gz diff --git a/pkg/unzip/url b/pkg/unzip/url @@ -0,0 +1 @@ +url = "http://downloads.sourceforge.net/infozip/unzip60.tar.gz" diff --git a/pkg/unzip/ver b/pkg/unzip/ver @@ -0,0 +1 @@ +6.0-29 r1 diff --git a/sets.lua b/sets.lua @@ -30,6 +30,7 @@ S.bin = { 'the_silver_searcher', 'transmission', 'u-config', + 'unzip', 'vis', 'zstd', }