All other were removed during ac_maketrans.
| ... | ... |
@@ -295,7 +295,7 @@ static int ac_maketrans(struct cli_matcher *root) |
| 295 | 295 |
continue; |
| 296 | 296 |
for(i = 0; i < 256; i++) {
|
| 297 | 297 |
child = node->trans[i]; |
| 298 |
- if(!child) {
|
|
| 298 |
+ if (!child || (!IS_FINAL(child) && IS_LEAF(child))) {
|
|
| 299 | 299 |
struct cli_ac_node *failtarget = node->fail; |
| 300 | 300 |
while(IS_LEAF(failtarget) || !failtarget->trans[i]) |
| 301 | 301 |
failtarget = failtarget->fail; |
| ... | ... |
@@ -892,14 +892,12 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v |
| 892 | 892 |
current = root->ac_root; |
| 893 | 893 |
|
| 894 | 894 |
for(i = 0; i < length; i++) {
|
| 895 |
- |
|
| 896 |
- if(IS_LEAF(current)) |
|
| 897 |
- current = current->fail; |
|
| 898 |
- |
|
| 899 | 895 |
current = current->trans[buffer[i]]; |
| 900 | 896 |
|
| 901 | 897 |
if(IS_FINAL(current)) {
|
| 902 | 898 |
patt = current->list; |
| 899 |
+ if (IS_LEAF(current)) |
|
| 900 |
+ current = current->fail; |
|
| 903 | 901 |
while(patt) {
|
| 904 | 902 |
bp = i + 1 - patt->depth; |
| 905 | 903 |
if(ac_findmatch(buffer, bp, length, patt, &matchend)) {
|