Fix some compilation warnings

This commit is contained in:
Nardi Ivan
2020-04-20 16:53:39 +02:00
parent e603549967
commit b1a6c6b895
7 changed files with 17 additions and 12 deletions
+4 -2
View File
@@ -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';