From: Nguyễn Thái Ngọc Duy Date: Sun, 11 Nov 2012 10:13:57 +0000 (+0700) Subject: compat/fnmatch: fix off-by-one character class's length check X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f10e3864dc3b0ba0051148f9b2b555df11fc337a;p=git.git 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 Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c index 9473aed2b..0ff1d273a 100644 --- a/compat/fnmatch/fnmatch.c +++ b/compat/fnmatch/fnmatch.c @@ -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;