diff options
author | Ron Yorston <rmy@pobox.com> | 2014-01-13 09:11:24 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-01-13 09:11:24 +0000 |
commit | e6edcba4f2fc20a3e9db75ebe82d7a71094fe17c (patch) | |
tree | af786c447cae6ca59e195b31fbae442c0b42d198 /archival | |
parent | 215f730e98215bff8dfacafdaa70e4a11395ad53 (diff) | |
parent | 0f592d7fb94c5887528d0ee24020c2225ab71c28 (diff) | |
download | busybox-w32-e6edcba4f2fc20a3e9db75ebe82d7a71094fe17c.tar.gz busybox-w32-e6edcba4f2fc20a3e9db75ebe82d7a71094fe17c.tar.bz2 busybox-w32-e6edcba4f2fc20a3e9db75ebe82d7a71094fe17c.zip |
Merge branch 'busybox' into merge
Conflicts:
include/platform.h
scripts/basic/fixdep.c
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libarchive/get_header_tar.c | 4 | ||||
-rw-r--r-- | archival/libarchive/open_transformer.c | 23 |
2 files changed, 14 insertions, 13 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 32f842095..54d910431 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c | |||
@@ -115,7 +115,9 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g | |||
115 | */ | 115 | */ |
116 | p += len; | 116 | p += len; |
117 | sz -= len; | 117 | sz -= len; |
118 | if ((int)sz < 0 | 118 | if ( |
119 | /** (int)sz < 0 - not good enough for huge malicious VALUE of 2^32-1 */ | ||
120 | (int)(sz|len) < 0 /* this works */ | ||
119 | || len == 0 | 121 | || len == 0 |
120 | || errno != EINVAL | 122 | || errno != EINVAL |
121 | || *end != ' ' | 123 | || *end != ' ' |
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index c4e02f0f7..b11bf46af 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
@@ -184,27 +184,26 @@ int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_detected) | |||
184 | 184 | ||
185 | int FAST_FUNC open_zipped(const char *fname) | 185 | int FAST_FUNC open_zipped(const char *fname) |
186 | { | 186 | { |
187 | char *sfx; | ||
188 | int fd; | 187 | int fd; |
189 | 188 | ||
190 | fd = open(fname, O_RDONLY); | 189 | fd = open(fname, O_RDONLY); |
191 | if (fd < 0) | 190 | if (fd < 0) |
192 | return fd; | 191 | return fd; |
193 | 192 | ||
194 | sfx = strrchr(fname, '.'); | 193 | if (ENABLE_FEATURE_SEAMLESS_LZMA) { |
195 | if (sfx) { | 194 | /* .lzma has no header/signature, can only detect it by extension */ |
196 | sfx++; | 195 | char *sfx = strrchr(fname, '.'); |
197 | if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0) | 196 | if (sfx && strcmp(sfx+1, "lzma") == 0) { |
198 | /* .lzma has no header/signature, just trust it */ | ||
199 | open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma"); | 197 | open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma"); |
200 | else | 198 | return fd; |
201 | if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0) | ||
202 | || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0) | ||
203 | || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0) | ||
204 | ) { | ||
205 | setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1); | ||
206 | } | 199 | } |
207 | } | 200 | } |
201 | if ((ENABLE_FEATURE_SEAMLESS_GZ) | ||
202 | || (ENABLE_FEATURE_SEAMLESS_BZ2) | ||
203 | || (ENABLE_FEATURE_SEAMLESS_XZ) | ||
204 | ) { | ||
205 | setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1); | ||
206 | } | ||
208 | 207 | ||
209 | return fd; | 208 | return fd; |
210 | } | 209 | } |