From 46ba657562b222c7eb45ac8ed3c0402d0fb5ca76 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sat, 22 Aug 2020 23:48:00 +0200 Subject: Cosmetic fix --- src/lib/ndpi_main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 4c9d5d37c..74d34edf8 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -107,11 +107,11 @@ void *ndpi_calloc(unsigned long count, size_t size) { void ndpi_free(void *ptr) { if(_ndpi_free) { if(ptr) - _ndpi_free(ptr); + _ndpi_free(ptr); } else { if(ptr) - free(ptr); - } + free(ptr); + } } /* ****************************************** */ @@ -2619,7 +2619,7 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_str, char *rule, else if(strncmp(attr, "host:", 5) == 0) { /* host:"",host:"",.....@ */ u_int i, max_len; - + value = &attr[5]; if(value[0] == '"') value++; /* remove leading " */ @@ -4781,7 +4781,7 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct if((default_ports[i] == sport) || (default_ports[i] == dport)) { found = 1; break; - } + } } /* for */ if((num_loops == 0) && (!found)) { @@ -4789,11 +4789,11 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct default_ports = ndpi_str->proto_defaults[ret.app_protocol].udp_default_ports; else default_ports = ndpi_str->proto_defaults[ret.app_protocol].tcp_default_ports; - + num_loops = 1; goto check_default_ports; } - + if(!found) { // printf("******** Invalid default port\n"); NDPI_SET_BIT(flow->risk, NDPI_KNOWN_PROTOCOL_ON_NON_STANDARD_PORT); @@ -6164,7 +6164,7 @@ int ndpi_match_hostname_protocol(struct ndpi_detection_module_struct *ndpi_struc /* Convert it first to lowercase: we assume meory is writable as in nDPI dissctors */ for(i=0; i max_domain_element_len) max_domain_element_len = curr_domain_element_len; - + curr_domain_element_len = 0; break; - + default: curr_domain_element_len++; break; } - + j++; } - + if(curr_domain_element_len > max_domain_element_len) max_domain_element_len = curr_domain_element_len; @@ -6695,7 +6695,7 @@ int ndpi_check_dga_name(struct ndpi_detection_module_struct *ndpi_str, printf("[DGA] [max_num_char_repetitions: %u][max_domain_element_len: %u]\n", max_num_char_repetitions, max_domain_element_len); #endif - + if( (max_num_char_repetitions > 5 /* num or consecutive repeated chars */) /* @@ -6711,7 +6711,7 @@ int ndpi_check_dga_name(struct ndpi_detection_module_struct *ndpi_str, if(flow) NDPI_SET_BIT(flow->risk, NDPI_SUSPICIOUS_DGA_DOMAIN); return(1); } - + tmp[j] = '\0'; len = j; @@ -6778,7 +6778,7 @@ int ndpi_check_dga_name(struct ndpi_detection_module_struct *ndpi_str, num_impossible++; } else if(ndpi_match_bigram(ndpi_str, &ndpi_str->bigrams_automa, &word[i])) { num_found++; - } + } } /* for */ } /* for */ -- cgit v1.2.3