From: Jo-Philipp Wich Date: Sun, 12 Apr 2015 20:18:15 +0000 (+0200) Subject: block: reject mount sections with relative targets X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cf8056385c287b98c70376034f0bfc59cc9261ed;p=oweals%2Ffstools.git 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 --- 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)