diff options
author | Luca Deri <deri@ntop.org> | 2024-02-22 23:19:01 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2024-02-22 23:19:01 +0100 |
commit | bfb21dc09bc3da92fbbbff41eea9560385772252 (patch) | |
tree | f79c43fe0ccf62c1254a969682509ebdf5df691d /src/lib/ndpi_utils.c | |
parent | 31c706c3dbbf0afc4c8e0a6d0bb6f20796296549 (diff) |
Fixes exception handling glitch
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 17e15b839..fec1c7568 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -2458,7 +2458,7 @@ void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndpi_str, if(host && (host[0] != '\0')) { /* Check host exception */ ndpi_check_hostname_risk_exception(ndpi_str, flow, host); - + if(flow->risk_mask == 0) { u_int i; @@ -2471,6 +2471,8 @@ void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndpi_str, ndpi_free(flow->risk_infos[i].info); flow->risk_infos[i].info = NULL; } + + flow->risk_infos[i].id = NDPI_NO_RISK; } flow->num_risk_infos = 0; @@ -2507,6 +2509,10 @@ void ndpi_set_risk(struct ndpi_detection_module_struct *ndpi_str, if(!ndpi_isset_risk(ndpi_str, flow, r)) { ndpi_risk v = 1ull << r; + /* In case there is an exception set, take it into account */ + if(flow->host_risk_mask_evaluated) + v &= flow->risk_mask; + // NDPI_SET_BIT(flow->risk, (u_int32_t)r); flow->risk |= v; |