aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-10-12 19:00:15 +0000
committerMatt Kraai <kraai@debian.org>2001-10-12 19:00:15 +0000
commitf86bbfaddd5803a173d51e41f18af9310f7a612c (patch)
tree791f4ff12dd1f384c9567eea16421af06f7bdac2
parent9b2589dafde8efc5327e597690c84bfbfe42d53f (diff)
downloadbusybox-f86bbfaddd5803a173d51e41f18af9310f7a612c.tar.gz
Fix tar segfault when include list is empty and exclude list is not.
-rw-r--r--Changelog2
-rw-r--r--archival/tar.c9
-rw-r--r--tar.c9
3 files changed, 14 insertions, 6 deletions
diff --git a/Changelog b/Changelog
index c34a7e470..6017ccb1d 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,8 @@
-- Fix sed s/[/]// handling (closes: #1208).
-- Fix `-/bin/sh' invocation (closes: #1209).
-- Fix ash exec (noted by Arne Bernin).
+ -- Fix tar segfault when include list is empty and exclude list is
+ not.
* Magick
-- made init run inittab command's in the order they show up
in the inittab file (FIFO instead of LIFO).
diff --git a/archival/tar.c b/archival/tar.c
index cd563393b..ea0247e56 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -528,7 +528,10 @@ char **merge_list(char **include_list, char **exclude_list)
int new_include_count = 0;
int include_count = 0;
int exclude_count;
-
+
+ if (include_list == NULL)
+ return exclude_list;
+
while (include_list[include_count] != NULL) {
int found = FALSE;
exclude_count = 0;
@@ -684,8 +687,8 @@ int tar_main(int argc, char **argv)
#ifdef BB_FEATURE_TAR_EXCLUDE
/* Remove excluded files from the include list */
if (exclude_list != NULL) {
- /* If both an exclude and include file list was present then
- * its an exclude from include list only, if not its really an
+ /* If both an exclude and include file list were present then
+ * it's an exclude from include list only, if not it's really an
* exclude list (and a poor choice of variable names) */
if (include_list == NULL) {
extract_function |= extract_exclude_list;
diff --git a/tar.c b/tar.c
index cd563393b..ea0247e56 100644
--- a/tar.c
+++ b/tar.c
@@ -528,7 +528,10 @@ char **merge_list(char **include_list, char **exclude_list)
int new_include_count = 0;
int include_count = 0;
int exclude_count;
-
+
+ if (include_list == NULL)
+ return exclude_list;
+
while (include_list[include_count] != NULL) {
int found = FALSE;
exclude_count = 0;
@@ -684,8 +687,8 @@ int tar_main(int argc, char **argv)
#ifdef BB_FEATURE_TAR_EXCLUDE
/* Remove excluded files from the include list */
if (exclude_list != NULL) {
- /* If both an exclude and include file list was present then
- * its an exclude from include list only, if not its really an
+ /* If both an exclude and include file list were present then
+ * it's an exclude from include list only, if not it's really an
* exclude list (and a poor choice of variable names) */
if (include_list == NULL) {
extract_function |= extract_exclude_list;