summaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorEric Andersen2001-06-27 06:15:50 +0000
committerEric Andersen2001-06-27 06:15:50 +0000
commit0d8cc1670cdb6c4acdad1e2fcd92cb378873355b (patch)
treedbbf9f3fc4c9c3641ed07a33edee33bf7226e27e /archival/libunarchive
parent4b6b5e4314e6b760bdc0cf51dfb1f01896f3b6d0 (diff)
downloadbusybox-0d8cc1670cdb6c4acdad1e2fcd92cb378873355b.zip
busybox-0d8cc1670cdb6c4acdad1e2fcd92cb378873355b.tar.gz
Fix a type promotion bug discivered and analyzed by Alan Modra
<amodra@bigpond.net.au>, which caused false checksum errors
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/decompress_unzip.c2
-rw-r--r--archival/libunarchive/unzip.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 7de2893..40b8af4 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
fread(buf, 1, 8, in_file);
/* Validate decompression - crc */
- if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
+ if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
error_msg("invalid compressed data--crc error");
}
/* Validate decompression - size */
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index 7de2893..40b8af4 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
fread(buf, 1, 8, in_file);
/* Validate decompression - crc */
- if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
+ if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
error_msg("invalid compressed data--crc error");
}
/* Validate decompression - size */