]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lib: parser: fix match_wildcard to correctly handle trailing stars
authorInseob Kim <inseob@google.com>
Thu, 26 Mar 2026 02:06:04 +0000 (11:06 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Apr 2026 06:36:24 +0000 (23:36 -0700)
This fixes a bug in match_wildcard that incorrectly handles trailing
asterisks.  For example, `match_wildcard("abc**", "abc")` must return
true, but it returns false.

Link: https://lkml.kernel.org/r/20260326020630.4139520-1-inseob@google.com
Signed-off-by: Inseob Kim <inseob@google.com>
Cc: Changbin Du <changbin.du@gmail.com>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Joe Perches <joe@perches.com>
Cc: Josh Law <objecting@objecting.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/parser.c

index 73e8f8e5be73ff671a64d2d96700cab01aa17bdb..62da0ac0d4389e05c86a9e1f56937bc6d804cc7b 100644 (file)
@@ -315,7 +315,7 @@ bool match_wildcard(const char *pattern, const char *str)
                }
        }
 
-       if (*p == '*')
+       while (*p == '*')
                ++p;
        return !*p;
 }