compat/fnmatch: fix off-by-one character class's length check
Character class "xdigit" is the only one that hits 6 character limit defined by CHAR_CLASS_MAX_LENGTH. All other character classes are 5 character long and therefore never caught by this. This should make xdigit tests in t3070 pass on Windows. Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Nov 11, 2012 at 17:13 UTC
f10e3864dc3b0ba0051148f9b2b555df11fc337a
1 file changed
+1
-1
compat/fnmatch/fnmatch.c
+1
-1
@@ -345,7 +345,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
345
346
for (;;)
347
{
348
- if (c1 == CHAR_CLASS_MAX_LENGTH)
348
+ if (c1 > CHAR_CLASS_MAX_LENGTH)
349
/* The name is too long and therefore the pattern
350
is ill-formed. */
351
return FNM_NOMATCH;