summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordcs <dcs@FreeBSD.org>2000-07-09 17:36:53 +0000
committerdcs <dcs@FreeBSD.org>2000-07-09 17:36:53 +0000
commit13a9107aac37e67e8ab42faaa4fd3b52bdb7c406 (patch)
treebc641dc4933443e060c47117f79a0ce430b20434 /lib
parentb42c412805b2d1944c8ae8bb09c9e16ae819cb71 (diff)
downloadFreeBSD-src-13a9107aac37e67e8ab42faaa4fd3b52bdb7c406.zip
FreeBSD-src-13a9107aac37e67e8ab42faaa4fd3b52bdb7c406.tar.gz
Since g->moffset points to the _maximum_ offset at which the must
string may be found (from the beginning of the pattern), the point at which must is found minus that offset may actually point to some place before the start of the text. In that case, make start = start. Alternatively, this could be tested for in the preceding if, but it did not occur to me. :-) Caught by: regex(3) test code
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/regex/engine.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index a12538f..04844ba 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -236,7 +236,7 @@ int eflags;
/* Adjust start according to moffset, to speed things up */
if (g->moffset > -1)
- start = dp - g->moffset;
+ start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
/* this loop does only one repetition except for backrefs */
for (;;) {
OpenPOWER on IntegriCloud