Skip to content

Commit f10e386

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7e20105 commit f10e386

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/fnmatch/fnmatch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
345345

346346
for (;;)
347347
{
348-
if (c1 == CHAR_CLASS_MAX_LENGTH)
348+
if (c1 > CHAR_CLASS_MAX_LENGTH)
349349
/* The name is too long and therefore the pattern
350350
is ill-formed. */
351351
return FNM_NOMATCH;

0 commit comments

Comments
 (0)