diff options
Diffstat (limited to 'archival/unzip.c')
-rw-r--r-- | archival/unzip.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index 3a11f78a5..3c76cdafc 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -249,15 +249,17 @@ static void unzip_extract(zip_header_t *zip_header, int dst_fd) | |||
249 | bb_copyfd_exact_size(zip_fd, dst_fd, size); | 249 | bb_copyfd_exact_size(zip_fd, dst_fd, size); |
250 | } else { | 250 | } else { |
251 | /* Method 8 - inflate */ | 251 | /* Method 8 - inflate */ |
252 | inflate_unzip_result res; | 252 | transformer_aux_data_t aux; |
253 | if (inflate_unzip(&res, zip_header->formatted.cmpsize, zip_fd, dst_fd) < 0) | 253 | init_transformer_aux_data(&aux); |
254 | aux.bytes_in = zip_header->formatted.cmpsize; | ||
255 | if (inflate_unzip(&aux, zip_fd, dst_fd) < 0) | ||
254 | bb_error_msg_and_die("inflate error"); | 256 | bb_error_msg_and_die("inflate error"); |
255 | /* Validate decompression - crc */ | 257 | /* Validate decompression - crc */ |
256 | if (zip_header->formatted.crc32 != (res.crc ^ 0xffffffffL)) { | 258 | if (zip_header->formatted.crc32 != (aux.crc32 ^ 0xffffffffL)) { |
257 | bb_error_msg_and_die("crc error"); | 259 | bb_error_msg_and_die("crc error"); |
258 | } | 260 | } |
259 | /* Validate decompression - size */ | 261 | /* Validate decompression - size */ |
260 | if (zip_header->formatted.ucmpsize != res.bytes_out) { | 262 | if (zip_header->formatted.ucmpsize != aux.bytes_out) { |
261 | /* Don't die. Who knows, maybe len calculation | 263 | /* Don't die. Who knows, maybe len calculation |
262 | * was botched somewhere. After all, crc matched! */ | 264 | * was botched somewhere. After all, crc matched! */ |
263 | bb_error_msg("bad length"); | 265 | bb_error_msg("bad length"); |