aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2023-11-02 20:46:14 +0100
committerLuca Deri <deri@ntop.org>2023-11-02 20:46:14 +0100
commit0db12b1390b1cc554b927230c76b05264c05b498 (patch)
tree0cbf27fc588608e20c09cb6cfb1c7059e5e8f044
parent6dcecd73d3413103d1f416721c2b2f46ff0968b7 (diff)
In case a pattern is redefined (for instance with protos.txt), the custom definition overwrites the previous one (so far it was ignored)
-rw-r--r--src/lib/third_party/src/ahocorasick.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/third_party/src/ahocorasick.c b/src/lib/third_party/src/ahocorasick.c
index 12bc422ac..eb7146943 100644
--- a/src/lib/third_party/src/ahocorasick.c
+++ b/src/lib/third_party/src/ahocorasick.c
@@ -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;
}