summaryrefslogtreecommitdiffstats
path: root/libbb/unarchive.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/unarchive.c')
-rw-r--r--libbb/unarchive.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index 24877e7..84a3b6a 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -600,15 +600,15 @@ file_header_t *get_header_tar(FILE *tar_stream)
linkname = NULL;
} else
#endif
- if (tar.formated.prefix[0] == 0) {
- tar_entry->name = strdup(tar.formated.name);
- } else {
- tar_entry->name = concat_path_file(tar.formated.prefix, tar.formated.name);
- }
+ {
+ tar_entry->name = xstrndup(tar.formated.name, 100);
- if (strlen(tar_entry->name) > 100) {
- tar_entry->name[100] = 0;
- }
+ if (tar.formated.prefix[0]) {
+ char *temp = tar_entry->name;
+ tar_entry->name = concat_path_file(tar.formated.prefix, temp);
+ free(temp);
+ }
+ }
// tar_entry->name = xstrdup(tar.formated.name);