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

This commit is contained in:
Steven Morgan 2014-01-02 17:19:05 -05:00
parent 9354e51399
commit 51c9a991eb

View file

@ -315,8 +315,9 @@ 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;
if (NULL != failtarget)
node->fail = failtarget;
continue;
}