From: Chris Webb Date: Mon, 24 Apr 2023 16:14:47 +0000 (+0100) Subject: libmount: Don't silently accept an X-mount.idmap with only whitespace X-Git-Tag: v2.39~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13e267f722f36e5fa7db94f22b6082a6864920e1;p=thirdparty%2Futil-linux.git libmount: Don't silently accept an X-mount.idmap with only whitespace X-mount.idmap accepts a series of whitespace-separated tokens. We reject an empty argument but silently accept an argument consisting of whitespace with no tokens. Test for the empty case more thoroughly. [kzak@redhat.com: - use skip_blank()] Signed-off-by: Chris Webb Signed-off-by: Karel Zak --- diff --git a/libmount/src/hook_idmap.c b/libmount/src/hook_idmap.c index affd8fb144..2e01ef4445 100644 --- a/libmount/src/hook_idmap.c +++ b/libmount/src/hook_idmap.c @@ -387,9 +387,11 @@ static int hook_prepare_options( opt = mnt_optlist_get_named(ol, "X-mount.idmap", cxt->map_userspace); if (!opt) return 0; - value = mnt_opt_get_value(opt); - if (!value) + value = mnt_opt_get_value(opt); + if (value) + value = skip_blank(p); + if (!value || !*value) return errno = EINVAL, -MNT_ERR_MOUNTOPT; hd = new_hook_data();