@@ -866,29 +866,30 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
{
if (*p == L_('\0'))
return FNM_NOMATCH;
- /* XXX 1003.2d11 is unclear if this is right. */
+
++p;
}
else if (c == L_('[') && *p == L_(':'))
{
- int c1 = 0;
- const CHAR *startp = p;
+ CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
+ size_t c1 = 0;
while (1)
{
c = *++p;
- if (++c1 == CHAR_CLASS_MAX_LENGTH)
- return FNM_NOMATCH;
-
- if (*p == L_(':') && p[1] == L_(']'))
+ if (c == L_(':') && p[1] == L_(']'))
break;
- if (c < L_('a') || c >= L_('z'))
- {
- p = startp - 2;
- break;
- }
+ if (c1 == CHAR_CLASS_MAX_LENGTH ||
+ (c < L_('a') || c > L_('z')))
+ return FNM_NOMATCH;
+
+ str[c1++] = c;
}
+ str[c1] = L_('\0');
+ if (IS_CHAR_CLASS (str) == 0)
+ return FNM_NOMATCH;
+
p += 2;
}
else if (c == L_('[') && *p == L_('='))