Skip to content

Commit

Permalink
compat/fnmatch: fix off-by-one character class's length check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Nov 20, 2012
1 parent 7e20105 commit f10e386
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/fnmatch/fnmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)

for (;;)
{
if (c1 == CHAR_CLASS_MAX_LENGTH)
if (c1 > CHAR_CLASS_MAX_LENGTH)
/* The name is too long and therefore the pattern
is ill-formed. */
return FNM_NOMATCH;
Expand Down

0 comments on commit f10e386

Please sign in to comment.