]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: Don't silently accept an X-mount.idmap with only whitespace
authorChris Webb <chris@arachsys.com>
Mon, 24 Apr 2023 16:14:47 +0000 (17:14 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 25 Apr 2023 09:56:58 +0000 (11:56 +0200)
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 <chris@arachsys.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hook_idmap.c

index affd8fb1443da860ff08298aacf17fcae6c6c88b..2e01ef4445cb9952eb3f0c1e42a465aa90f27b24 100644 (file)
@@ -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();