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/tls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols/tls.c') 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