From 13e267f722f36e5fa7db94f22b6082a6864920e1 Mon Sep 17 00:00:00 2001 From: Chris Webb Date: Mon, 24 Apr 2023 17:14:47 +0100 Subject: [PATCH] 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 --- libmount/src/hook_idmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(); -- 2.47.3