Skip to content

Commit

Permalink
In case a pattern is redefined (for instance with protos.txt), the cu…
Browse files Browse the repository at this point in the history
…stom definition overwrites the previous one (so far it was ignored)
  • Loading branch information
lucaderi committed Nov 2, 2023
1 parent 6dcecd7 commit 0db12b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/third_party/src/ahocorasick.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,18 @@ AC_ERROR_t ac_automata_add (AC_AUTOMATA_t * thiz, AC_PATTERN_t * patt)
thiz->max_str_len = patt->length;

if(n->final && n->matched_patterns) {
/*
In this case an existing pattern exists and thus we overwrite
the previous protocol value with this one
*/

#if 1
/* nDPI code */
n->matched_patterns->patterns[0].rep.number = patt->rep.number;
#else
/* original code */
patt->rep.number = n->matched_patterns->patterns[0].rep.number;
#endif
return ACERR_DUPLICATE_PATTERN;
}

Expand Down

0 comments on commit 0db12b1

Please sign in to comment.