summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-04 19:34:22 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-04 19:37:01 +0200
commita86e2f471f5b8299823cf51feea0a50de4368f04 (patch)
treee62bc2ada6b39ccc390d1abb0e634b5cb0d94a26
parent8ce28a622dbfbf2d4db3e9805e95e532c8e2dc13 (diff)
Fix: tar2sqfs move skip for invalid name first
If the name is missing or invalid, set the skip flag to true to skip the tar record and use the same skip logic as for the others. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--tar/tar2sqfs.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 0dad73a..1b7d3aa 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -266,7 +266,13 @@ static int process_tar_ball(fstree_t *fs, data_writer_t *data)
skip = false;
- if (hdr.unknown_record) {
+ if (hdr.name == NULL || canonicalize_name(hdr.name) != 0) {
+ fprintf(stderr, "skipping '%s' (invalid name)\n",
+ hdr.name);
+ skip = true;
+ }
+
+ if (!skip && hdr.unknown_record) {
fprintf(stderr, "%s: unknown entry type\n", hdr.name);
skip = true;
}
@@ -301,14 +307,6 @@ static int process_tar_ball(fstree_t *fs, data_writer_t *data)
continue;
}
- if (canonicalize_name(hdr.name)) {
- fprintf(stderr, "skipping '%s' (invalid name)\n",
- hdr.name);
- if (skip_entry(STDIN_FILENO, hdr.sb.st_size))
- goto fail;
- continue;
- }
-
if (create_node_and_repack_data(&hdr, fs, data))
goto fail;