summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordcs <dcs@FreeBSD.org>2001-11-09 10:17:44 +0000
committerdcs <dcs@FreeBSD.org>2001-11-09 10:17:44 +0000
commit652ecfdbf332f9d7c928288c46ee85f12b179308 (patch)
treeabf0494275d04c813176e71df06a77429eaeb1f7 /lib
parent66dabcc793efb40567d212a22a6bd88f4d264dc0 (diff)
downloadFreeBSD-src-652ecfdbf332f9d7c928288c46ee85f12b179308.zip
FreeBSD-src-652ecfdbf332f9d7c928288c46ee85f12b179308.tar.gz
The algorithm that computes the tables used in the BM search algorithm sometimes
access an array beyond it's length. This only happens in the last iteration of a loop, and the value fetched is not used then, so the bug is a relatively innocent one. Fix this by not fetching any value on the last iteration of said loop. Submitted by: MKI <mki@mozone.net> MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/regex/regcomp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index bf92f2c..602ddb0 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -2045,7 +2045,8 @@ struct re_guts *g;
g->mlen + ssuffix - suffix);
suffix++;
}
- ssuffix = pmatches[ssuffix];
+ if (suffix < g->mlen)
+ ssuffix = pmatches[ssuffix];
}
free(pmatches);
OpenPOWER on IntegriCloud