From 79e06f899ad26bf66a6902a41212fefafa73d379 Mon Sep 17 00:00:00 2001 From: elasota Date: Sat, 2 Sep 2023 19:58:15 -0400 Subject: [PATCH] COMMON: Fix String::matchString matching excluded characters with trailing asterisk wildcards --- common/str.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/str.cpp b/common/str.cpp index 9994f209b32..193e5b3ed16 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -638,6 +638,7 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, const char * const char *p = nullptr; const char *q = nullptr; bool escaped = false; + bool noExclusions = (wildcardExclusions == nullptr || !*wildcardExclusions); for (;;) { if (wildcardExclusions && strchr(wildcardExclusions, *str)) { @@ -662,8 +663,8 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, const char * p = nullptr; q = nullptr; } - // If pattern ended with * -> match - if (!*pat) + // If pattern ended with * and there are no exclusions -> match + if (!*pat && noExclusions) return true; break;