From bece5ca7c19138807a8ddb6d1a9c351b47fc5f99 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 19 Nov 1998 18:39:58 +0000 Subject: Update. 1998-11-19 Ulrich Drepper * posix/regex.c (regex_compile): Handle extra long class names correctly. --- posix/regex.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'posix') diff --git a/posix/regex.c b/posix/regex.c index 5f8e38c791..ba01f73508 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -2210,10 +2210,13 @@ regex_compile (pattern, size, syntax, bufp) for (;;) { PATFETCH (c); - if ((c == ':' && *p == ']') || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) + if ((c == ':' && *p == ']') || p == pend) break; - str[c1++] = c; + if (c1 < CHAR_CLASS_MAX_LENGTH) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; } str[c1] = '\0'; -- cgit 1.4.1