aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 83094602d..760d29a26 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -43,7 +43,7 @@
#include "ndpi_content_match.c.inc"
#include "third_party/include/ndpi_patricia.h"
-#include "third_party/include/hash.h"
+#include "third_party/include/ht_hash.h"
#define NDPI_CONST_GENERIC_PROTOCOL_NAME "GenericProtocol"
@@ -741,7 +741,6 @@ void ndpi_init_protocol_match(struct ndpi_detection_module_struct *ndpi_mod,
u_int16_t no_master[2] = { NDPI_PROTOCOL_NO_MASTER_PROTO, NDPI_PROTOCOL_NO_MASTER_PROTO };
ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS];
static u_int16_t generic_id = NDPI_LAST_IMPLEMENTED_PROTOCOL;
- u_int16_t p_id;
if(ndpi_mod->proto_defaults[match->protocol_id].protoName == NULL) {
if(match->protocol_id == NDPI_PROTOCOL_GENERIC)
@@ -989,7 +988,6 @@ static void ndpi_validate_protocol_initialization(struct ndpi_detection_module_s
Do NOT add web services (NDPI_SERVICE_xxx) here.
*/
static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndpi_mod) {
- int i;
ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS];
u_int16_t no_master[2] = { NDPI_PROTOCOL_NO_MASTER_PROTO, NDPI_PROTOCOL_NO_MASTER_PROTO },
custom_master[2];
@@ -5706,7 +5704,7 @@ char* ndpi_strnstr(const char *s, const char *find, size_t slen) {
size_t len;
if((c = *find++) != '\0') {
- len = strlen(find);
+ len = strnlen(find, slen);
do {
do {
if(slen-- < 1 || (sc = *s++) == '\0')
@@ -5714,10 +5712,11 @@ char* ndpi_strnstr(const char *s, const char *find, size_t slen) {
} while (sc != c);
if(len > slen)
return (NULL);
- } while (strncmp(s, find, len) != 0);
+ } while(strncmp(s, find, len) != 0);
s--;
}
- return ((char *)s);
+
+ return((char *)s);
}
/* ****************************************************** */