From cf8056385c287b98c70376034f0bfc59cc9261ed Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 12 Apr 2015 22:18:15 +0200 Subject: [PATCH] block: reject mount sections with relative targets Specifying relative target paths leads to undefined results and confuses users. Explicitely reject relative paths with a warning instead of doing random stuff. Signed-off-by: Jo-Philipp Wich --- block.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block.c b/block.c index aecf366..4c8dda9 100644 --- a/block.c +++ b/block.c @@ -274,6 +274,13 @@ static int mount_add(struct uci_section *s) if (m->target && !strcmp(m->target, "/overlay")) m->extroot = m->overlay = 1; + if (m->target && *m->target != '/') { + ULOG_WARN("ignoring mount section %s due to invalid target '%s'\n", + s->e.name, m->target); + free(m); + return -1; + } + if (m->uuid) vlist_add(&mounts, &m->node, m->uuid); else if (m->label) -- 2.25.1