diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/syntax.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/syntax.c b/src/syntax.c index 62612620f03..302250c39a4 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1455,7 +1455,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) | |||
| 1455 | { | 1455 | { |
| 1456 | const unsigned char *class_beg = str + i_byte + 1; | 1456 | const unsigned char *class_beg = str + i_byte + 1; |
| 1457 | const unsigned char *class_end = class_beg; | 1457 | const unsigned char *class_end = class_beg; |
| 1458 | const unsigned char *class_limit = str + size_byte; | 1458 | const unsigned char *class_limit = str + size_byte - 2; |
| 1459 | /* Leave room for the null. */ | 1459 | /* Leave room for the null. */ |
| 1460 | unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; | 1460 | unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; |
| 1461 | re_wctype_t cc; | 1461 | re_wctype_t cc; |
| @@ -1463,17 +1463,13 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) | |||
| 1463 | if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) | 1463 | if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) |
| 1464 | class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; | 1464 | class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; |
| 1465 | 1465 | ||
| 1466 | while (class_end != class_limit | 1466 | while (class_end < class_limit |
| 1467 | && ! (*class_end >= 0200 | 1467 | && *class_end >= 'a' && *class_end <= 'z') |
| 1468 | || *class_end <= 040 | ||
| 1469 | || (*class_end == ':' | ||
| 1470 | && class_end[1] == ']'))) | ||
| 1471 | class_end++; | 1468 | class_end++; |
| 1472 | 1469 | ||
| 1473 | if (class_end == class_limit | 1470 | if (class_end == class_beg |
| 1474 | || *class_end >= 0200 | 1471 | || *class_end != ':' || class_end[1] != ']') |
| 1475 | || *class_end <= 040) | 1472 | goto not_a_class_name; |
| 1476 | error ("Invalid ISO C character class"); | ||
| 1477 | 1473 | ||
| 1478 | bcopy (class_beg, class_name, class_end - class_beg); | 1474 | bcopy (class_beg, class_name, class_end - class_beg); |
| 1479 | class_name[class_end - class_beg] = 0; | 1475 | class_name[class_end - class_beg] = 0; |
| @@ -1488,6 +1484,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) | |||
| 1488 | continue; | 1484 | continue; |
| 1489 | } | 1485 | } |
| 1490 | 1486 | ||
| 1487 | not_a_class_name: | ||
| 1491 | if (c == '\\') | 1488 | if (c == '\\') |
| 1492 | { | 1489 | { |
| 1493 | if (i_byte == size_byte) | 1490 | if (i_byte == size_byte) |