Fixes exception handling glitch

This commit is contained in:
Luca Deri
2024-02-22 23:19:01 +01:00
parent 31c706c3db
commit bfb21dc09b
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* ndpi_api.h
*
* Copyright (C) 2011-20 - ntop.org
* Copyright (C) 2011-24 - ntop.org
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
+7 -1
View File
@@ -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;