netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/8 v2] textsearch: fix Boyer-Moore text search bug
@ 2008-06-25 10:24 Joonwoo Park
  2008-06-25 10:57 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Joonwoo Park @ 2008-06-25 10:24 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: netdev, netfilter-devel, Thomas Graf, Pablo Neira Ayuso,
	Joonwoo Park

The current logic has a bug which cannot find matching pattern, if the
pattern is matched from the first character of target string.
for example:
	pattern=abc, string=abcdefg
	pattern=a,   string=abcdefg
Searching algorithm should return 0 for those things.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 lib/ts_bm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/ts_bm.c b/lib/ts_bm.c
index d90822c..4a7fce7 100644
--- a/lib/ts_bm.c
+++ b/lib/ts_bm.c
@@ -63,7 +63,7 @@ static unsigned int bm_find(struct ts_config *conf, struct ts_state *state)
 	struct ts_bm *bm = ts_config_priv(conf);
 	unsigned int i, text_len, consumed = state->offset;
 	const u8 *text;
-	int shift = bm->patlen, bs;
+	int shift = bm->patlen - 1, bs;
 
 	for (;;) {
 		text_len = conf->get_next_block(consumed, &text, conf, state);
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-25 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 10:24 [PATCH 2/8 v2] textsearch: fix Boyer-Moore text search bug Joonwoo Park
2008-06-25 10:57 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).