* [TEXTSEARCH]: Fix Boyer Moore initialization bug
@ 2006-08-22 2:07 Patrick McHardy
2006-08-22 7:45 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2006-08-22 2:07 UTC (permalink / raw)
To: David S. Miller; +Cc: Netfilter Development Mailinglist, stable, Adrian Bunk
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Hi Dave,
this fixes an initialization bug in the bm textsearch
algorithm affecting the netfilter string match (the
only user AFAIK). Please apply to 2.6.18, thanks.
@stable maintainers: the bm_ts author asked me to also
submit this to -stable, please apply.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1771 bytes --]
[TEXTSEARCH]: Fix Boyer Moore initialization bug
The pattern is set after trying to compute the prefix table, which tries
to use it. Initialize it before calling compute_prefix_tbl, make
compute_prefix_tbl consistently use only the data from struct ts_bm
and remove the now unnecessary arguments.
Signed-off-by: Michael Rash <mbr@cipherdyne.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 96d2404fab775fc7aebf06956bd3ea5e8996b0f7
tree 682dee25bd20e0d85f909fbf5967db2844d58253
parent 8ebd6bb0f469f2759f39e73adee6916a3d975393
author Michael Rash <mbr@cipherdyne.org> Thu, 17 Aug 2006 17:43:21 +0200
committer Patrick McHardy <kaber@trash.net> Thu, 17 Aug 2006 17:43:21 +0200
lib/ts_bm.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/ts_bm.c b/lib/ts_bm.c
index 0110e44..d90822c 100644
--- a/lib/ts_bm.c
+++ b/lib/ts_bm.c
@@ -111,15 +111,14 @@ static int subpattern(u8 *pattern, int i
return ret;
}
-static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern,
- unsigned int len)
+static void compute_prefix_tbl(struct ts_bm *bm)
{
int i, j, g;
for (i = 0; i < ASIZE; i++)
- bm->bad_shift[i] = len;
- for (i = 0; i < len - 1; i++)
- bm->bad_shift[pattern[i]] = len - 1 - i;
+ bm->bad_shift[i] = bm->patlen;
+ for (i = 0; i < bm->patlen - 1; i++)
+ bm->bad_shift[bm->pattern[i]] = bm->patlen - 1 - i;
/* Compute the good shift array, used to match reocurrences
* of a subpattern */
@@ -150,8 +149,8 @@ static struct ts_config *bm_init(const v
bm = ts_config_priv(conf);
bm->patlen = len;
bm->pattern = (u8 *) bm->good_shift + prefix_tbl_len;
- compute_prefix_tbl(bm, pattern, len);
memcpy(bm->pattern, pattern, len);
+ compute_prefix_tbl(bm);
return conf;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [TEXTSEARCH]: Fix Boyer Moore initialization bug
2006-08-22 2:07 [TEXTSEARCH]: Fix Boyer Moore initialization bug Patrick McHardy
@ 2006-08-22 7:45 ` David Miller
2006-08-25 22:09 ` [stable] " Greg KH
2006-09-18 17:26 ` Adrian Bunk
0 siblings, 2 replies; 4+ messages in thread
From: David Miller @ 2006-08-22 7:45 UTC (permalink / raw)
To: kaber; +Cc: netfilter-devel, stable, bunk
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 22 Aug 2006 04:07:57 +0200
> this fixes an initialization bug in the bm textsearch
> algorithm affecting the netfilter string match (the
> only user AFAIK). Please apply to 2.6.18, thanks.
>
> @stable maintainers: the bm_ts author asked me to also
> submit this to -stable, please apply.
Applied and Ack'd for -stable.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [stable] [TEXTSEARCH]: Fix Boyer Moore initialization bug
2006-08-22 7:45 ` David Miller
@ 2006-08-25 22:09 ` Greg KH
2006-09-18 17:26 ` Adrian Bunk
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-08-25 22:09 UTC (permalink / raw)
To: David Miller; +Cc: bunk, netfilter-devel, kaber, stable
On Tue, Aug 22, 2006 at 12:45:34AM -0700, David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Tue, 22 Aug 2006 04:07:57 +0200
>
> > this fixes an initialization bug in the bm textsearch
> > algorithm affecting the netfilter string match (the
> > only user AFAIK). Please apply to 2.6.18, thanks.
> >
> > @stable maintainers: the bm_ts author asked me to also
> > submit this to -stable, please apply.
>
> Applied and Ack'd for -stable.
Queued to -stable, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [TEXTSEARCH]: Fix Boyer Moore initialization bug
2006-08-22 7:45 ` David Miller
2006-08-25 22:09 ` [stable] " Greg KH
@ 2006-09-18 17:26 ` Adrian Bunk
1 sibling, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2006-09-18 17:26 UTC (permalink / raw)
To: David Miller; +Cc: netfilter-devel, kaber, stable
On Tue, Aug 22, 2006 at 12:45:34AM -0700, David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Tue, 22 Aug 2006 04:07:57 +0200
>
> > this fixes an initialization bug in the bm textsearch
> > algorithm affecting the netfilter string match (the
> > only user AFAIK). Please apply to 2.6.18, thanks.
> >
> > @stable maintainers: the bm_ts author asked me to also
> > submit this to -stable, please apply.
>
> Applied and Ack'd for -stable.
Thanks, applied to 2.6.16.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-18 17:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 2:07 [TEXTSEARCH]: Fix Boyer Moore initialization bug Patrick McHardy
2006-08-22 7:45 ` David Miller
2006-08-25 22:09 ` [stable] " Greg KH
2006-09-18 17:26 ` Adrian Bunk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.