From b1a6c6b8957b62ec8ada423abfdcfa5471c00147 Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Wed, 15 Apr 2020 18:07:24 +0200 Subject: Fix some compilation warnings --- src/lib/protocols/rx.c | 5 +++++ src/lib/protocols/tls.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols') diff --git a/src/lib/protocols/rx.c b/src/lib/protocols/rx.c index 64dbe7d0f..3bcab3b85 100644 --- a/src/lib/protocols/rx.c +++ b/src/lib/protocols/rx.c @@ -129,19 +129,24 @@ void ndpi_check_rx(struct ndpi_detection_module_struct *ndpi_struct, header->flags == PLUS_2 || header->flags == REQ_ACK || header->flags == MORE_1) goto security; + /* Fall-through */ case ACK: if(header->flags == CLIENT_INIT_1 || header->flags == CLIENT_INIT_2 || header->flags == EMPTY) goto security; + /* Fall-through */ case CHALLENGE: if(header->flags == EMPTY || header->call_number == 0) goto security; + /* Fall-through */ case RESPONSE: if(header->flags == EMPTY || header->call_number == 0) goto security; + /* Fall-through */ case ACKALL: if(header->flags == EMPTY) goto security; + /* Fall-through */ case BUSY: goto security; case ABORT: diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 560e483ac..a6d7883ce 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -316,8 +316,10 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi i += 2; - if((len > sizeof(dNSName)-1) || (len == 0 /* Looks something went wrong */)) - break; /* String too long */ + /* The check "len > sizeof(dNSName) - 1" will be always false. If we add it, + the compiler is smart enough to detect it and throws a warning */ + if((len == 0 /* Looks something went wrong */)) + break; strncpy(dNSName, (const char*)&packet->payload[i], len); dNSName[len] = '\0'; -- cgit v1.2.3