summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tar/tar2sqfs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 627cae9..30f1abb 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -345,12 +345,26 @@ static int process_tar_ball(void)
skip = false;
+ if (hdr.name != NULL && strcmp(hdr.name, "./") == 0 &&
+ S_ISDIR(hdr.sb.st_mode)) {
+ /* XXX: tar entries might be prefixed with ./ which is
+ stripped by cannonicalize_name, but the tar file may
+ contain a directory entry named './' */
+ clear_header(&hdr);
+ continue;
+ }
+
if (hdr.name == NULL || canonicalize_name(hdr.name) != 0) {
fprintf(stderr, "skipping '%s' (invalid name)\n",
hdr.name);
skip = true;
}
+ if (hdr.name[0] == '\0') {
+ fputs("skipping entry with empty name\n", stderr);
+ skip = true;
+ }
+
if (!skip && hdr.unknown_record) {
fprintf(stderr, "%s: unknown entry type\n", hdr.name);
skip = true;