# HG changeset patch # User Kim F. Storm # Date 1087292551 0 # Node ID 6725db0f57d57ecbf729bba80945e8d956d3d597 # Parent f5427343598928dc0331d9de410c0fcd072882e4 (skip_chars): Only recognize [:class:] when it has the proper format and class is a lower-case word. diff -r f54273435989 -r 6725db0f57d5 src/syntax.c --- a/src/syntax.c Tue Jun 15 09:42:18 2004 +0000 +++ b/src/syntax.c Tue Jun 15 09:42:31 2004 +0000 @@ -1455,7 +1455,7 @@ { const unsigned char *class_beg = str + i_byte + 1; const unsigned char *class_end = class_beg; - const unsigned char *class_limit = str + size_byte; + const unsigned char *class_limit = str + size_byte - 2; /* Leave room for the null. */ unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; re_wctype_t cc; @@ -1463,17 +1463,13 @@ if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; - while (class_end != class_limit - && ! (*class_end >= 0200 - || *class_end <= 040 - || (*class_end == ':' - && class_end[1] == ']'))) + while (class_end < class_limit + && *class_end >= 'a' && *class_end <= 'z') class_end++; - if (class_end == class_limit - || *class_end >= 0200 - || *class_end <= 040) - error ("Invalid ISO C character class"); + if (class_end == class_beg + || *class_end != ':' || class_end[1] != ']') + goto not_a_class_name; bcopy (class_beg, class_name, class_end - class_beg); class_name[class_end - class_beg] = 0; @@ -1488,6 +1484,7 @@ continue; } + not_a_class_name: if (c == '\\') { if (i_byte == size_byte)