summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-05-02 02:54:37 +0000
committertjr <tjr@FreeBSD.org>2004-05-02 02:54:37 +0000
commit8caabe19ec31e101a51c2ad7b493359d5d2f731c (patch)
tree79d7f07120c8803a6549c2c13a2798c607c8b75e /gnu/usr.bin
parent7d92f80dd20e07fd13c71a1150a9425629487012 (diff)
downloadFreeBSD-src-8caabe19ec31e101a51c2ad7b493359d5d2f731c.zip
FreeBSD-src-8caabe19ec31e101a51c2ad7b493359d5d2f731c.tar.gz
Apply patch from gzip web page to correctly decompress files larger than
4GB on architectures with 64-bit long integers.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/gzip/unzip.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gnu/usr.bin/gzip/unzip.c b/gnu/usr.bin/gzip/unzip.c
index e36555a..f06994f 100644
--- a/gnu/usr.bin/gzip/unzip.c
+++ b/gnu/usr.bin/gzip/unzip.c
@@ -35,6 +35,7 @@ static char rcsid[] = "$FreeBSD$";
#define LOCEXT 28 /* offset of extra field length */
#define LOCHDR 30 /* size of local header, including sig */
#define EXTHDR 16 /* size of extended local header, inc sig */
+#define RAND_HEAD_LEN 12 /* length of encryption random header */
/* Globals */
@@ -103,6 +104,7 @@ int unzip(in, out)
ulg orig_len = 0; /* original uncompressed length */
int n;
uch buf[EXTHDR]; /* extended local header */
+ int err = OK;
ifd = in;
ofd = out;
@@ -136,9 +138,6 @@ int unzip(in, out)
}
while (n--) {
uch c = (uch)get_byte();
-#ifdef CRYPT
- if (decrypt) zdecode(c);
-#endif
put_ubyte(c);
}
flush_window();
@@ -172,10 +171,14 @@ int unzip(in, out)
/* Validate decompression */
if (orig_crc != updcrc(outbuf, 0)) {
- error("invalid compressed data--crc error");
+ fprintf(stderr, "\n%s: %s: invalid compressed data--crc error\n",
+ progname, ifname);
+ err = ERROR;
}
- if (orig_len != (ulg)bytes_out) {
- error("invalid compressed data--length error");
+ if (((orig_len - (ulg)bytes_out) & 0x0ffffffffL) != 0) {
+ fprintf(stderr, "\n%s: %s: invalid compressed data--length error\n",
+ progname, ifname);
+ err = ERROR;
}
/* Check if there are more entries in a pkzip file */
@@ -189,11 +192,12 @@ int unzip(in, out)
fprintf(stderr,
"%s: %s has more than one entry -- unchanged\n",
progname, ifname);
- exit_code = ERROR;
- ext_header = pkzip = 0;
- return ERROR;
+ err = ERROR;
}
}
ext_header = pkzip = 0; /* for next file */
- return OK;
+ if (err == OK) return OK;
+ exit_code = ERROR;
+ if (!test) abort_gzip();
+ return err;
}
OpenPOWER on IntegriCloud