textsearch: fix Boyer-Moore text search bug 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@xxxxxxxxx> Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx> --- commit cf07ecdeb187d567890ade083f0c1fa298085dee tree 6a7cf5c6bdc80c75ec843d8ee44cd98039ca6fd7 parent 5c61a61f0df27eba716646da0b7371bf49f13d89 author Joonwoo Park <joonwpark81@xxxxxxxxx> Mon, 30 Jun 2008 17:40:34 +0200 committer Patrick McHardy <kaber@xxxxxxxxx> Mon, 30 Jun 2008 17:40:34 +0200 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); -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html