summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-10-18 14:31:14 +0000
committerJim Meyering <jim@meyering.net>1995-10-18 14:31:14 +0000
commit539457f1ae28a703c72a60eb4d59b09af552f27e (patch)
tree2a976b8b6ccefeab25aa8ce2826442d58ab934f6 /lib
parentb6ff24fb7f15dafaeabba6a7b51030adf8663b9c (diff)
downloadcoreutils-539457f1ae28a703c72a60eb4d59b09af552f27e.tar.xz
Merge latest change from FSF.
Diffstat (limited to 'lib')
-rw-r--r--lib/regex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/regex.c b/lib/regex.c
index ca485a896..348bd3649 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -3265,9 +3265,10 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
return -1;
/* Fix up RANGE if it might eventually take us outside
- the virtual concatenation of STRING1 and STRING2. */
- if (endpos < -1)
- range = -1 - startpos;
+ the virtual concatenation of STRING1 and STRING2.
+ Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
+ if (endpos < 0)
+ range = 0 - startpos;
else if (endpos > total_size)
range = total_size - startpos;