summaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-05 23:56:53 +0000
committerDenis Vlasenko2007-01-05 23:56:53 +0000
commitcd42cb8df066ffd4449af6de168190669dad4453 (patch)
tree10731cda21479451f3ca050c9f030b682a1d99aa /archival/unzip.c
parent447b543eafeed669112085fc877a29c726e1947e (diff)
downloadbusybox-cd42cb8df066ffd4449af6de168190669dad4453.zip
busybox-cd42cb8df066ffd4449af6de168190669dad4453.tar.gz
do not expose internal state of [g]zip unpacker.
fix memory leak in inflate_gunzip.
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 34a3a85..b10132e 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -76,16 +76,16 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
bb_copyfd_exact_size(src_fd, dst_fd, size);
} else {
/* Method 8 - inflate */
- inflate_init(zip_header->formatted.cmpsize);
- inflate_unzip(src_fd, dst_fd);
- inflate_cleanup();
+ inflate_unzip_result res;
+ /* err = */ inflate_unzip(&res, zip_header->formatted.cmpsize, src_fd, dst_fd);
+// we should check for -1 error return
/* Validate decompression - crc */
- if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) {
+ if (zip_header->formatted.crc32 != (res.crc ^ 0xffffffffL)) {
bb_error_msg("invalid compressed data--%s error", "crc");
return 1;
}
/* Validate decompression - size */
- if (zip_header->formatted.ucmpsize != gunzip_bytes_out) {
+ if (zip_header->formatted.ucmpsize != res.bytes_out) {
bb_error_msg("invalid compressed data--%s error", "length");
return 1;
}