aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-05 23:56:53 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-05 23:56:53 +0000
commit57053ee5e498b7afe91cb67f6731ad0c51a7c7a6 (patch)
tree10731cda21479451f3ca050c9f030b682a1d99aa /archival/unzip.c
parenta4639334d8e29e50174f6f2d329878c443d322d1 (diff)
downloadbusybox-w32-57053ee5e498b7afe91cb67f6731ad0c51a7c7a6.tar.gz
busybox-w32-57053ee5e498b7afe91cb67f6731ad0c51a7c7a6.tar.bz2
busybox-w32-57053ee5e498b7afe91cb67f6731ad0c51a7c7a6.zip
do not expose internal state of [g]zip unpacker.
fix memory leak in inflate_gunzip. git-svn-id: svn://busybox.net/trunk/busybox@17167 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 34a3a8519..b10132ebd 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)
76 bb_copyfd_exact_size(src_fd, dst_fd, size); 76 bb_copyfd_exact_size(src_fd, dst_fd, size);
77 } else { 77 } else {
78 /* Method 8 - inflate */ 78 /* Method 8 - inflate */
79 inflate_init(zip_header->formatted.cmpsize); 79 inflate_unzip_result res;
80 inflate_unzip(src_fd, dst_fd); 80 /* err = */ inflate_unzip(&res, zip_header->formatted.cmpsize, src_fd, dst_fd);
81 inflate_cleanup(); 81// we should check for -1 error return
82 /* Validate decompression - crc */ 82 /* Validate decompression - crc */
83 if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) { 83 if (zip_header->formatted.crc32 != (res.crc ^ 0xffffffffL)) {
84 bb_error_msg("invalid compressed data--%s error", "crc"); 84 bb_error_msg("invalid compressed data--%s error", "crc");
85 return 1; 85 return 1;
86 } 86 }
87 /* Validate decompression - size */ 87 /* Validate decompression - size */
88 if (zip_header->formatted.ucmpsize != gunzip_bytes_out) { 88 if (zip_header->formatted.ucmpsize != res.bytes_out) {
89 bb_error_msg("invalid compressed data--%s error", "length"); 89 bb_error_msg("invalid compressed data--%s error", "length");
90 return 1; 90 return 1;
91 } 91 }