]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: treat comma as terminator in mnt_match_options()
authorKarel Zak <kzak@redhat.com>
Tue, 28 Feb 2023 10:56:44 +0000 (11:56 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 28 Feb 2023 10:56:44 +0000 (11:56 +0100)
An alone "no" in the pattern is interpreted as an error; it should be also
valid in case the keyword is followed by a comma, e.g.

mnt_match_options("bla", "no,,");

Suggested-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/optstr.c

index 4fbbb085950c41df729203a53aee41d2ac0ce638..a0056c767f835a78ee2d54283f02c2dc21e7587a 100644 (file)
@@ -865,7 +865,7 @@ int mnt_match_options(const char *optstr, const char *pattern)
                        name++, namesz--;
                else if ((no = (startswith(name, "no") != NULL))) {
                        name += 2, namesz -= 2;
-                       if (!*name) {
+                       if (!*name || *name == ',') {
                                match = 0;
                                break;  /* alone "no" keyword is error */
                        }