diff options
-rw-r--r-- | libbb/unarchive.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c index fe061ea12..a17f7af50 100644 --- a/libbb/unarchive.c +++ b/libbb/unarchive.c | |||
@@ -219,6 +219,9 @@ char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *), | |||
219 | int i; | 219 | int i; |
220 | char *buffer = NULL; | 220 | char *buffer = NULL; |
221 | 221 | ||
222 | if (extract_names == NULL) { | ||
223 | return(NULL); | ||
224 | } | ||
222 | archive_offset = 0; | 225 | archive_offset = 0; |
223 | while ((file_entry = get_headers(src_stream)) != NULL) { | 226 | while ((file_entry = get_headers(src_stream)) != NULL) { |
224 | found = FALSE; | 227 | found = FALSE; |
@@ -259,7 +262,6 @@ file_header_t *get_header_ar(FILE *src_stream) | |||
259 | static char *ar_long_names; | 262 | static char *ar_long_names; |
260 | 263 | ||
261 | if (fread(ar.raw, 1, 60, src_stream) != 60) { | 264 | if (fread(ar.raw, 1, 60, src_stream) != 60) { |
262 | free (ar_long_names); | ||
263 | return(NULL); | 265 | return(NULL); |
264 | } | 266 | } |
265 | archive_offset += 60; | 267 | archive_offset += 60; |
@@ -535,10 +537,14 @@ char *deb_extract(const char *package_filename, FILE *out_stream, | |||
535 | char **file_list; | 537 | char **file_list; |
536 | int gunzip_pid; | 538 | int gunzip_pid; |
537 | 539 | ||
538 | file_list = malloc(sizeof(char *)); | 540 | if (filename == NULL) { |
539 | file_list[0] = xstrdup(filename); | 541 | file_list = NULL; |
540 | file_list[1] = NULL; | 542 | } else { |
541 | 543 | file_list = xmalloc(sizeof(char *) * 3); | |
544 | file_list[0] = xstrdup(filename); | ||
545 | file_list[1] = NULL; | ||
546 | } | ||
547 | |||
542 | if (extract_function & extract_control_tar_gz) { | 548 | if (extract_function & extract_control_tar_gz) { |
543 | ared_file = xstrdup("control.tar.gz"); | 549 | ared_file = xstrdup("control.tar.gz"); |
544 | } | 550 | } |