aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-04-25 16:37:28 +0200
committerGitHub <noreply@github.com>2023-04-25 16:37:28 +0200
commit40b6d5a2e193322e6e93b2eeb087c51d8eb6faad (patch)
treecb5a338df534f710c74107717cc9be54c07211ac /src/lib/ndpi_utils.c
parentde693cbbc91d4144b8d67a8c99c565ea21cece09 (diff)
fuzz: extend fuzzers coverage (#1952)
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 8f89ef7bf..343c5b0f0 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -2018,39 +2018,30 @@ const char* ndpi_risk2str(ndpi_risk_enum risk) {
case NDPI_POSSIBLE_EXPLOIT:
return("Possible Exploit");
- break;
case NDPI_TLS_CERTIFICATE_ABOUT_TO_EXPIRE:
return("TLS Cert About To Expire");
- break;
case NDPI_PUNYCODE_IDN:
return("IDN Domain Name");
- break;
case NDPI_ERROR_CODE_DETECTED:
return("Error Code");
- break;
case NDPI_HTTP_CRAWLER_BOT:
return("Crawler/Bot");
- break;
case NDPI_ANONYMOUS_SUBSCRIBER:
return("Anonymous Subscriber");
- break;
case NDPI_UNIDIRECTIONAL_TRAFFIC:
return("Unidirectional Traffic");
- break;
case NDPI_HTTP_OBSOLETE_SERVER:
return("HTTP Obsolete Server");
- break;
case NDPI_PERIODIC_FLOW:
return("Periodic Flow");
- break;
case NDPI_MINOR_ISSUES:
return("Minor Issues");
@@ -2070,27 +2061,21 @@ const char* ndpi_severity2str(ndpi_risk_severity s) {
switch(s) {
case NDPI_RISK_LOW:
return("Low");
- break;
case NDPI_RISK_MEDIUM:
return("Medium");
- break;
case NDPI_RISK_HIGH:
return("High");
- break;
case NDPI_RISK_SEVERE:
return("Severe");
- break;
case NDPI_RISK_CRITICAL:
return("Critical");
- break;
case NDPI_RISK_EMERGENCY:
return("Emergency");
- break;
}
return("");
@@ -2367,7 +2352,7 @@ static u_int8_t ndpi_check_hostname_risk_exception(struct ndpi_detection_module_
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
u_int8_t ret = 0;
- if(automa->ac_automa) {
+ if(automa && automa->ac_automa) {
AC_TEXT_t ac_input_text;
AC_REP_t match;
@@ -2880,6 +2865,9 @@ u_int8_t ndpi_check_flow_risk_exceptions(struct ndpi_detection_module_struct *nd
ndpi_risk_params params[]) {
u_int i;
+ if(!ndpi_str)
+ return(0);
+
for(i=0; i<num_params; i++) {
switch(params[i].id) {
case NDPI_PARAM_HOSTNAME: