aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-08-22 20:04:15 +0200
committerLuca Deri <deri@ntop.org>2019-08-22 20:04:15 +0200
commit2134f83948b629640b4c372dfdfc9f2eaf7b20a2 (patch)
treec6ecb403fbf7447ec993fc29b6458eebcaa3500e /src
parent3d3cae1f205bdac6187e33718bd919d3d61e1b16 (diff)
Warning fixes
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/tls.c1
-rw-r--r--src/lib/protocols/tor.c5
-rw-r--r--src/lib/protocols/ubntac2.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c
index d9b7b0962..557768c03 100644
--- a/src/lib/protocols/tls.c
+++ b/src/lib/protocols/tls.c
@@ -242,7 +242,6 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct,
|| (handshake_protocol == 0x0b) /* Server Hello and Certificate message types are interesting for us */) {
u_int num_found = 0;
u_int16_t tls_version;
- int i;
if(packet->tcp)
tls_version = ntohs(*((u_int16_t*)&packet->payload[header_len+4]));
diff --git a/src/lib/protocols/tor.c b/src/lib/protocols/tor.c
index 3b2dd06c4..b3070d0b9 100644
--- a/src/lib/protocols/tor.c
+++ b/src/lib/protocols/tor.c
@@ -20,7 +20,7 @@ static void ndpi_int_tor_add_connection(struct ndpi_detection_module_struct
int ndpi_is_tls_tor(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, char *certificate) {
- int prev_num = 0, numbers_found = 0, num_found = 0, i, len, num_impossible = 0;
+ int len;
char dummy[48], *dot, *name;
if((certificate == NULL) || (certificate[0] == '\0'))
@@ -51,6 +51,8 @@ int ndpi_is_tls_tor(struct ndpi_detection_module_struct *ndpi_struct,
len = strlen(name);
if(len >= 5) {
+ int i, prev_num = 0, numbers_found = 0, num_found = 0, num_impossible = 0;
+
for(i = 0; name[i+1] != '\0'; i++) {
// printf("***** [SSL] %s(): [%d][%c]", __FUNCTION__, i, name[i]);
@@ -66,7 +68,6 @@ int ndpi_is_tls_tor(struct ndpi_detection_module_struct *ndpi_struct,
}
} else
prev_num = 0;
-
if(ndpi_match_bigram(ndpi_struct, &ndpi_struct->bigrams_automa, &name[i])) {
num_found++;
diff --git a/src/lib/protocols/ubntac2.c b/src/lib/protocols/ubntac2.c
index 2e35d1d98..cb6a02b6b 100644
--- a/src/lib/protocols/ubntac2.c
+++ b/src/lib/protocols/ubntac2.c
@@ -50,14 +50,16 @@ void ndpi_search_ubntac2(struct ndpi_detection_module_struct *ndpi_struct, struc
}
if(found) {
- char version[256];
- int i, j, len;
-
found += packet->payload[found+1] + 4; /* Skip model name */
found++; /* Skip len*/
if(found < packet->payload_packet_len) {
- for(i=found, j=0; (packet->payload[i] != 0) && (i < packet->payload_packet_len) && (i < (sizeof(version)-1)); i++)
+ char version[256];
+ int i, j, len;
+
+ for(i=found, j=0; (i < packet->payload_packet_len)
+ && (i < (sizeof(version)-1))
+ && (packet->payload[i] != 0); i++)
version[j++] = packet->payload[i];
version[j] = '\0';