Skip to contentSkip to conversation

: textsearch: fix Boyer-Moore text search bug

PATCH In review Patrick McHardy 2 participants 2 messages Jul 7, 2008 – Jul 17, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 : textsearch: fix Boyer-Moore text search bug

These two patches for -stable fix a bug in the BM textsearch algorithm, leading to false negatives, and packets incorrectly marked as INVALID by TCP conntrack.

Please apply, thanks.

textsearch: fix Boyer-Moore text search bug

Upstream commit aebb6a8:

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.

---
commit 44e450bf173eee791911a56f7e65a30d94608cea
tree 9be6fda8b20945d835a0dc6b466341f6cd9132e9
parent 76605033bb81028b4c603a324dcec6793b7da8ae
author Joonwoo Park <[email protected]> Mon, 07 Jul 2008 15:52:15 +0200 committer Patrick McHardy <[email protected]> Mon, 07 Jul 2008 15:52:15 +0200

 lib/ts_bm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/ts_bm.c +1 -1
index d90822c..4a7fce7 100644
@@ -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 lore raw

patch textsearch-fix-boyer-moore-text-search-bug.patch added to 2.6.25-stable tree

This is a note to let you know that we have just queued up the patch titled

Subject: textsearch: fix Boyer-Moore text search bug

to the 2.6.25-stable tree. Its filename is

textsearch-fix-boyer-moore-text-search-bug.patch

A git repo of this tree can be found at
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 1 line

From [email protected] Wed Jul 16 22:27:41 2008

From: Joonwoo Park <[email protected]>
Date: Mon, 07 Jul 2008 15:56:57 +0200
Subject: textsearch: fix Boyer-Moore text search bug
To: [email protected]
Cc: Netfilter Development Mailinglist <[email protected]>, "David S. Miller" <[email protected]>
Message-ID: <[email protected]>

From: Joonwoo Park <[email protected]>

Upstream commit aebb6a849cfe7d89bcacaaecc20a480dfc1180e7

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.

---
 lib/ts_bm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ts_bm.c +1 -1
@@ -63,7 +63,7 @@ static unsigned int bm_find(struct ts_co
 	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);

Patches currently in stable-queue which might be from [email protected] are

queue-2.6.25/textsearch-fix-boyer-moore-text-search-bug.patch