From 27ff810a59c0c5f10577403919117d9453d47d06 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 30 Apr 2019 12:34:59 +0200 Subject: Cannonicalize path names read from the input file Signed-off-by: David Oberhollenzer --- lib/fstree/fstree_from_file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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 #include @@ -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; -- cgit v1.2.3