bb#9659 correction to construction of Aho-Corasick trie fail links.

0.98.2
Steven Morgan 12 years ago
parent 9354e51399
commit 51c9a991eb
  1. 5
      libclamav/matcher-ac.c

@ -315,9 +315,10 @@ static int ac_maketrans(struct cli_matcher *root)
while((node = bfs_dequeue(&bfs, &bfs_last))) {
if(IS_LEAF(node)) {
struct cli_ac_node *failtarget = node->fail;
while(IS_LEAF(failtarget))
while (NULL != failtarget && (IS_LEAF(failtarget) || !IS_FINAL(failtarget)))
failtarget = failtarget->fail;
node->fail = failtarget;
if (NULL != failtarget)
node->fail = failtarget;
continue;
}

Loading…
Cancel
Save