diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 686d091ef85b..c3949706fb82 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -2118,12 +2118,16 @@ print_list(int fd, off_t out, const char *outfile, time_t ts) maybe_warnx("read of uncompressed size"); else { - usize = buf[4] | buf[5] << 8 | - buf[6] << 16 | buf[7] << 24; + usize = buf[4]; + usize |= (unsigned int)buf[5] << 8; + usize |= (unsigned int)buf[6] << 16; + usize |= (unsigned int)buf[7] << 24; in = (off_t)usize; #ifndef SMALL - crc = buf[0] | buf[1] << 8 | - buf[2] << 16 | buf[3] << 24; + crc = buf[0]; + crc |= (unsigned int)buf[1] << 8; + crc |= (unsigned int)buf[2] << 16; + crc |= (unsigned int)buf[3] << 24; #endif } }