summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index c0b8676645..91bbecad4f 100644
--- a/regex.c
+++ b/regex.c
@@ -3063,6 +3063,7 @@ re_search(bufp, string, size, startpos, range, regs)
if (range > 0 && (bufp->options & RE_OPTIMIZE_EXACTN)) {
startpos += pos;
range -= pos;
+ if (range < 0) return -1;
}
}