Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251004020906.1464237-2-musl@raf.org>
Date: Sat,  4 Oct 2025 12:09:06 +1000
From: raf <musl@....org>
To: musl@...ts.openwall.com
Cc: raf <raf@....org>
Subject: [PATCH] fnmatch: Make ? match binary/non-character byte (like * does)

From: raf <raf@....org>

---
 src/regex/fnmatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/regex/fnmatch.c b/src/regex/fnmatch.c
index 978fff88..24858c03 100644
--- a/src/regex/fnmatch.c
+++ b/src/regex/fnmatch.c
@@ -181,11 +181,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
 			break;
 		default:
 			k = str_next(str, n, &sinc);
-			if (k <= 0)
+			if (k <= 0 && !(k == -1 && c == QUESTION))
 				return (c==END) ? 0 : FNM_NOMATCH;
 			str += sinc;
 			n -= sinc;
-			kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
+			kfold = flags & FNM_CASEFOLD && k != -1 ? casefold(k) : k;
 			if (c == BRACKET) {
 				if (!match_bracket(pat, k, kfold))
 					return FNM_NOMATCH;
-- 
2.39.5

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.