diff options
author | Joonwoo Park <joonwpark81@gmail.com> | 2008-06-30 15:42:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-30 15:42:23 -0400 |
commit | aebb6a849cfe7d89bcacaaecc20a480dfc1180e7 (patch) | |
tree | 6a7cf5c6bdc80c75ec843d8ee44cd98039ca6fd7 /lib/ts_bm.c | |
parent | 84ebe1cdae56707b9aa1b40ae5aa7d817ba745f5 (diff) |
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@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/ts_bm.c')
-rw-r--r-- | 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 d90822c378a4..4a7fce72898e 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) | |||
63 | struct ts_bm *bm = ts_config_priv(conf); | 63 | struct ts_bm *bm = ts_config_priv(conf); |
64 | unsigned int i, text_len, consumed = state->offset; | 64 | unsigned int i, text_len, consumed = state->offset; |
65 | const u8 *text; | 65 | const u8 *text; |
66 | int shift = bm->patlen, bs; | 66 | int shift = bm->patlen - 1, bs; |
67 | 67 | ||
68 | for (;;) { | 68 | for (;;) { |
69 | text_len = conf->get_next_block(consumed, &text, conf, state); | 69 | text_len = conf->get_next_block(consumed, &text, conf, state); |