diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-18 09:34:50 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-18 09:34:50 +0000 |
commit | 9281f45d10af14f1f1dd884e8c77d293240c7412 (patch) | |
tree | e104b4c82d22e0932f3ec1dbb1a98611ebb24bc6 /posix/regex.c | |
parent | f1a785acbf05051be4963474f2307aad77fff16b (diff) | |
download | glibc-9281f45d10af14f1f1dd884e8c77d293240c7412.tar.gz glibc-9281f45d10af14f1f1dd884e8c77d293240c7412.tar.xz glibc-9281f45d10af14f1f1dd884e8c77d293240c7412.zip |
Update.
2000-01-18 Ulrich Drepper <drepper@cygnus.com> * posix/regex.h (RE_SYNTAX_POSIX_EXTENDED): Add RE_CONTEXT_INVALID_OPS. * posix/regex.c (regex_compile): Return appropriate errors for unterminated brace expressions. Detect invalid characters in brace expressions. * posix/bits/posix2_lim.h: Define RE_DUP_MAX correctly. * sysdeps/posix/sysconf.c: Include regex.h. Reported by Geoff Clare <gwc@unisoft.com> (PR libc/1522).
Diffstat (limited to 'posix/regex.c')
-rw-r--r-- | posix/regex.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/posix/regex.c b/posix/regex.c index d036a7dd3a..6dd3d2a96f 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -2,7 +2,7 @@ version 0.12. (Implements POSIX draft P1003.2/D11.2, except for some of the internationalization features.) - Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1993-1999, 2000 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -2910,7 +2910,7 @@ regex_compile (pattern, size, syntax, bufp) if (p == pend) { - if (syntax & RE_NO_BK_BRACES) + if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) goto unfetch_interval; else FREE_STACK_RETURN (REG_EBRACE); @@ -2921,7 +2921,12 @@ regex_compile (pattern, size, syntax, bufp) if (c == ',') { GET_UNSIGNED_NUMBER (upper_bound); - if (upper_bound < 0) upper_bound = RE_DUP_MAX; + if ((!(syntax & RE_NO_BK_BRACES) && c != '\\') + || ((syntax & RE_NO_BK_BRACES) && c != '}')) + FREE_STACK_RETURN (REG_BADBR); + + if (upper_bound < 0) + upper_bound = RE_DUP_MAX; } else /* Interval such as `{1}' => match exactly once. */ @@ -2930,7 +2935,7 @@ regex_compile (pattern, size, syntax, bufp) if (lower_bound < 0 || upper_bound > RE_DUP_MAX || lower_bound > upper_bound) { - if (syntax & RE_NO_BK_BRACES) + if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) goto unfetch_interval; else FREE_STACK_RETURN (REG_BADBR); @@ -2945,7 +2950,7 @@ regex_compile (pattern, size, syntax, bufp) if (c != '}') { - if (syntax & RE_NO_BK_BRACES) + if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) goto unfetch_interval; else FREE_STACK_RETURN (REG_BADBR); |