Skip to content

Commit

Permalink
added patch to fix a bug where repetitive strings could not be matche…
Browse files Browse the repository at this point in the history
…d within payload data except at specific offests

git-svn-id: file:///home/mbr/svn/fwsnort_repos/fwsnort/trunk@274 af5c991a-1414-0410-86ad-c3437102cd4a
  • Loading branch information
mrash committed Sep 4, 2006
1 parent 56fc5fd commit a5d67b4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions patches/bm_goodshift_fix.patch
@@ -0,0 +1,32 @@
--- linux-2.6.17.8/lib/ts_bm.c.orig 2006-08-16 21:17:38.000000000 -0400
+++ linux-2.6.17.8/lib/ts_bm.c 2006-08-17 10:35:25.000000000 -0400
@@ -112,15 +112,14 @@
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 */
@@ -151,8 +150,8 @@
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;
}

0 comments on commit a5d67b4

Please sign in to comment.