From dad9228494e3cc03dc477e8109f43119390b53c4 Mon Sep 17 00:00:00 2001
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date: Mon, 9 Dec 2019 15:52:38 +0100
Subject: Only check for OS specific bad filenames when unpacking

When converting a SquashFS image to a tarball, it makes no sense to
refuse conversion if the filename is considered evil by the OS.

This patch adds an option to is_filename_sane to check if the OS has
a problem with the given file name. sqfs2tar sets it to false and
converts everything while rdsquashfs sets it to true when unpacking.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
---
 tar/sqfs2tar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tar')

diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c
index 8cfad62..6767b95 100644
--- a/tar/sqfs2tar.c
+++ b/tar/sqfs2tar.c
@@ -311,7 +311,7 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
 		name[len] = '/';
 		name[len + 1] = '\0';
 	} else {
-		if (!is_filename_sane((const char *)n->name)) {
+		if (!is_filename_sane((const char *)n->name, false)) {
 			fprintf(stderr, "Found a file named '%s', skipping.\n",
 				n->name);
 			if (dont_skip) {
-- 
cgit v1.2.3