Fix tar segfault when include list is empty and exclude list is not.

This commit is contained in:
Matt Kraai 2001-10-12 19:00:15 +00:00
parent 9b2589dafd
commit f86bbfaddd
3 changed files with 14 additions and 6 deletions

View File

@ -20,6 +20,8 @@
-- Fix sed s/[/]// handling (closes: #1208). -- Fix sed s/[/]// handling (closes: #1208).
-- Fix `-/bin/sh' invocation (closes: #1209). -- Fix `-/bin/sh' invocation (closes: #1209).
-- Fix ash exec (noted by Arne Bernin). -- Fix ash exec (noted by Arne Bernin).
-- Fix tar segfault when include list is empty and exclude list is
not.
* Magick * Magick
-- made init run inittab command's in the order they show up -- made init run inittab command's in the order they show up
in the inittab file (FIFO instead of LIFO). in the inittab file (FIFO instead of LIFO).

View File

@ -528,7 +528,10 @@ char **merge_list(char **include_list, char **exclude_list)
int new_include_count = 0; int new_include_count = 0;
int include_count = 0; int include_count = 0;
int exclude_count; int exclude_count;
if (include_list == NULL)
return exclude_list;
while (include_list[include_count] != NULL) { while (include_list[include_count] != NULL) {
int found = FALSE; int found = FALSE;
exclude_count = 0; exclude_count = 0;
@ -684,8 +687,8 @@ int tar_main(int argc, char **argv)
#ifdef BB_FEATURE_TAR_EXCLUDE #ifdef BB_FEATURE_TAR_EXCLUDE
/* Remove excluded files from the include list */ /* Remove excluded files from the include list */
if (exclude_list != NULL) { if (exclude_list != NULL) {
/* If both an exclude and include file list was present then /* If both an exclude and include file list were present then
* its an exclude from include list only, if not its really an * it's an exclude from include list only, if not it's really an
* exclude list (and a poor choice of variable names) */ * exclude list (and a poor choice of variable names) */
if (include_list == NULL) { if (include_list == NULL) {
extract_function |= extract_exclude_list; extract_function |= extract_exclude_list;

9
tar.c
View File

@ -528,7 +528,10 @@ char **merge_list(char **include_list, char **exclude_list)
int new_include_count = 0; int new_include_count = 0;
int include_count = 0; int include_count = 0;
int exclude_count; int exclude_count;
if (include_list == NULL)
return exclude_list;
while (include_list[include_count] != NULL) { while (include_list[include_count] != NULL) {
int found = FALSE; int found = FALSE;
exclude_count = 0; exclude_count = 0;
@ -684,8 +687,8 @@ int tar_main(int argc, char **argv)
#ifdef BB_FEATURE_TAR_EXCLUDE #ifdef BB_FEATURE_TAR_EXCLUDE
/* Remove excluded files from the include list */ /* Remove excluded files from the include list */
if (exclude_list != NULL) { if (exclude_list != NULL) {
/* If both an exclude and include file list was present then /* If both an exclude and include file list were present then
* its an exclude from include list only, if not its really an * it's an exclude from include list only, if not it's really an
* exclude list (and a poor choice of variable names) */ * exclude list (and a poor choice of variable names) */
if (include_list == NULL) { if (include_list == NULL) {
extract_function |= extract_exclude_list; extract_function |= extract_exclude_list;