aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 69599a7dc..8020ea540 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -2468,6 +2468,26 @@ void ndpi_set_risk(struct ndpi_detection_module_struct *ndpi_str,
}
}
}
+ } else if(risk_message) {
+ u_int8_t i;
+
+ for(i = 0; i < flow->num_risk_infos; i++)
+ if(flow->risk_infos[i].id == r)
+ return;
+
+ /* Risk already set without any details, but now we have a specific risk_message
+ that we want to save.
+ This might happen with NDPI_HTTP_CRAWLER_BOT which might have been set early via
+ IP matching (no details) and now via UA matching (with message). */
+ if(flow->num_risk_infos < MAX_NUM_RISK_INFOS) {
+ char *s = ndpi_strdup(risk_message);
+
+ if(s != NULL) {
+ flow->risk_infos[flow->num_risk_infos].id = r;
+ flow->risk_infos[flow->num_risk_infos].info = s;
+ flow->num_risk_infos++;
+ }
+ }
}
}