From 652ecfdbf332f9d7c928288c46ee85f12b179308 Mon Sep 17 00:00:00 2001 From: dcs Date: Fri, 9 Nov 2001 10:17:44 +0000 Subject: 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 MFC after: 1 week --- lib/libc/regex/regcomp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libc/regex') 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); -- cgit v1.1