Added null pointer checks
This commit is contained in:
+24
-18
@@ -2182,16 +2182,18 @@ static u_int64_t ndpi_host_ip_risk_ptree_match(struct ndpi_detection_module_stru
|
|||||||
/* Check isuerDN exception */
|
/* Check isuerDN exception */
|
||||||
u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
||||||
char *issuerDN) {
|
char *issuerDN) {
|
||||||
ndpi_list *head = ndpi_str->trusted_issuer_dn;
|
if(issuerDN != NULL) {
|
||||||
|
ndpi_list *head = ndpi_str->trusted_issuer_dn;
|
||||||
|
|
||||||
while(head != NULL) {
|
while(head != NULL) {
|
||||||
if(strcmp(issuerDN, head->value) == 0)
|
if(strcmp(issuerDN, head->value) == 0)
|
||||||
return(1); /* This is a trusted DN */
|
return(1); /* This is a trusted DN */
|
||||||
else
|
else
|
||||||
head = head->next;
|
head = head->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0 /* no exception */);
|
return(0 /* no exception */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************* */
|
/* ********************************************************************************* */
|
||||||
@@ -2200,23 +2202,27 @@ u_int8_t ndpi_check_issuerdn_risk_exception(struct ndpi_detection_module_struct
|
|||||||
static u_int8_t ndpi_check_hostname_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
static u_int8_t ndpi_check_hostname_risk_exception(struct ndpi_detection_module_struct *ndpi_str,
|
||||||
struct ndpi_flow_struct *flow,
|
struct ndpi_flow_struct *flow,
|
||||||
char *hostname) {
|
char *hostname) {
|
||||||
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
if(hostname == NULL)
|
||||||
u_int8_t ret = 0;
|
return(0);
|
||||||
|
else {
|
||||||
if(automa->ac_automa) {
|
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
||||||
AC_TEXT_t ac_input_text;
|
u_int8_t ret = 0;
|
||||||
AC_REP_t match;
|
|
||||||
|
|
||||||
ac_input_text.astring = hostname, ac_input_text.length = strlen(hostname);
|
if(automa->ac_automa) {
|
||||||
ac_input_text.option = 0;
|
AC_TEXT_t ac_input_text;
|
||||||
|
AC_REP_t match;
|
||||||
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0) {
|
|
||||||
if(flow) flow->risk_mask &= match.number64;
|
ac_input_text.astring = hostname, ac_input_text.length = strlen(hostname);
|
||||||
ret = 1;
|
ac_input_text.option = 0;
|
||||||
|
|
||||||
|
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0) {
|
||||||
|
if(flow) flow->risk_mask &= match.number64;
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************* */
|
/* ********************************************************************************* */
|
||||||
@@ -2236,7 +2242,7 @@ static u_int8_t ndpi_check_ipv4_exception(struct ndpi_detection_module_struct *n
|
|||||||
return((r != (u_int64_t)-1) ? 1 : 0);
|
return((r != (u_int64_t)-1) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************* */
|
/* ********************************************************************************* */
|
||||||
|
|
||||||
static void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndpi_str,
|
static void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndpi_str,
|
||||||
struct ndpi_flow_struct *flow) {
|
struct ndpi_flow_struct *flow) {
|
||||||
|
|||||||
Reference in New Issue
Block a user