From a86e2f471f5b8299823cf51feea0a50de4368f04 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 4 Jul 2019 19:34:22 +0200 Subject: 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 --- tar/tar2sqfs.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tar') 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; -- cgit v1.2.3