aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-04-30 12:34:59 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-02 12:40:06 +0200
commit27ff810a59c0c5f10577403919117d9453d47d06 (patch)
tree17fefcf064f809e9fd8d2b9a1f4a2f29fc527d9d
parent02232ffdbd7b927b71a9f38f4b78bbf99c675ec5 (diff)
Cannonicalize path names read from the input file
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/fstree/fstree_from_file.c8
-rw-r--r--mkfs/Makemodule.am2
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c
index 66d71a2..7c6b9ba 100644
--- a/lib/fstree/fstree_from_file.c
+++ b/lib/fstree/fstree_from_file.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
#include "fstree.h"
+#include "util.h"
#include <sys/sysmacros.h>
#include <sys/types.h>
@@ -253,9 +254,9 @@ static void trim_line(char *line)
static int handle_line(fstree_t *fs, const char *filename,
size_t line_num, char *line)
{
- const char *path, *extra = NULL, *msg = NULL;
+ const char *extra = NULL, *msg = NULL;
unsigned int mode = 0, uid = 0, gid = 0, x;
- char keyword[16];
+ char keyword[16], *path;
size_t i;
/* isolate keyword */
@@ -288,6 +289,9 @@ static int handle_line(fstree_t *fs, const char *filename,
while (isspace(line[i]))
++i;
+ if (canonicalize_name(path) || *path == '\0')
+ goto fail_ent;
+
/* mode */
if (!isdigit(line[i]))
goto fail_mode;
diff --git a/mkfs/Makemodule.am b/mkfs/Makemodule.am
index 1f0acf2..f1afdf5 100644
--- a/mkfs/Makemodule.am
+++ b/mkfs/Makemodule.am
@@ -3,7 +3,7 @@ mksquashfs_SOURCES += mkfs/options.c mkfs/options.h
mksquashfs_SOURCES += mkfs/meta_writer.c mkfs/meta_writer.h
mksquashfs_SOURCES += mkfs/super.c
mksquashfs_SOURCES += include/squashfs.h
-mksquashfs_LDADD = libutil.a libfstree.a libcompress.a
+mksquashfs_LDADD = libfstree.a libcompress.a libutil.a
if WITH_LZMA
mksquashfs_LDADD += $(XZ_LIBS)