summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/regex.c b/regex.c
index d684eca835..7db560bb98 100644
--- a/regex.c
+++ b/regex.c
@@ -2373,9 +2373,10 @@ re_compile_pattern(pattern, size, bufp)
nextp = p + mbclen(c) - 1;
if (!pending_exact || pending_exact + *pending_exact + 1 != b
|| *pending_exact >= (c1 ? 0176 : 0177)
- || *nextp == '+' || *nextp == '?'
- || *nextp == '*' || *nextp == '^'
- || *nextp == '{') {
+ || (nextp < pend &&
+ ( *nextp == '+' || *nextp == '?'
+ || *nextp == '*' || *nextp == '^'
+ || *nextp == '{'))) {
laststart = b;
BUFPUSH(exactn);
pending_exact = b;