aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-12-09 09:04:58 +0000
committerRon Yorston <rmy@pobox.com>2017-12-09 09:04:58 +0000
commitbcf14b82e442e797fdd370afc80a82ef295ac1b0 (patch)
tree133c2b3df5445c508953fee17576ed932af07c7a /archival/unzip.c
parent65e9c0ad92a316e36efbc584b72b96a7eb8fa9db (diff)
parenta07fead8235c479f428dd5265e4f3539abb9c3fe (diff)
downloadbusybox-w32-bcf14b82e442e797fdd370afc80a82ef295ac1b0.tar.gz
busybox-w32-bcf14b82e442e797fdd370afc80a82ef295ac1b0.tar.bz2
busybox-w32-bcf14b82e442e797fdd370afc80a82ef295ac1b0.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 233487697..c5fb6a3ed 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -56,7 +56,7 @@
56//kbuild:lib-$(CONFIG_UNZIP) += unzip.o 56//kbuild:lib-$(CONFIG_UNZIP) += unzip.o
57 57
58//usage:#define unzip_trivial_usage 58//usage:#define unzip_trivial_usage
59//usage: "[-lnopq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]" 59//usage: "[-lnojpq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]"
60//usage:#define unzip_full_usage "\n\n" 60//usage:#define unzip_full_usage "\n\n"
61//usage: "Extract FILEs from ZIP archive\n" 61//usage: "Extract FILEs from ZIP archive\n"
62//usage: "\n -l List contents (with -q for short form)" 62//usage: "\n -l List contents (with -q for short form)"
@@ -808,13 +808,6 @@ int unzip_main(int argc, char **argv)
808 /* Guard against "/abspath", "/../" and similar attacks */ 808 /* Guard against "/abspath", "/../" and similar attacks */
809 overlapping_strcpy(dst_fn, strip_unsafe_prefix(dst_fn)); 809 overlapping_strcpy(dst_fn, strip_unsafe_prefix(dst_fn));
810 810
811 if (opts & OPT_j) /* Strip paths? */
812 overlapping_strcpy(dst_fn, bb_basename(dst_fn));
813
814 /* Did this strip everything ("DIR/" case)? Then skip */
815 if (!dst_fn[0])
816 goto skip_cmpsize;
817
818 /* Filter zip entries */ 811 /* Filter zip entries */
819 if (find_list_entry(zreject, dst_fn) 812 if (find_list_entry(zreject, dst_fn)
820 || (zaccept && !find_list_entry(zaccept, dst_fn)) 813 || (zaccept && !find_list_entry(zaccept, dst_fn))
@@ -879,6 +872,14 @@ int unzip_main(int argc, char **argv)
879 /* Extracting to STDOUT */ 872 /* Extracting to STDOUT */
880 goto do_extract; 873 goto do_extract;
881 } 874 }
875
876 /* Strip paths (after -l: unzip -lj a.zip lists full names) */
877 if (opts & OPT_j)
878 overlapping_strcpy(dst_fn, bb_basename(dst_fn));
879 /* Did this strip everything ("DIR/" case)? Then skip */
880 if (!dst_fn[0])
881 goto skip_cmpsize;
882
882 if (last_char_is(dst_fn, '/')) { 883 if (last_char_is(dst_fn, '/')) {
883 int mode; 884 int mode;
884 885