From 9ca87a620a39dbec76e28ea9ebe149c62de5b011 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Wed, 17 Jul 2019 15:31:48 +0200 Subject: Added extar check Warning fix --- src/lib/ndpi_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/ndpi_main.c') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 43e13201a..686de7798 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2263,14 +2263,14 @@ int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct, int ndpi_get_custom_category_match(struct ndpi_detection_module_struct *ndpi_struct, char *name_or_ip, unsigned long *id) { - char ipbuf[64]; + char ipbuf[64], *ptr; struct in_addr pin; if(!ndpi_struct->custom_categories.categories_loaded) return -1; - - strncpy(ipbuf, name_or_ip, sizeof(ipbuf)); - char *ptr = strrchr(ipbuf, '/'); + + snprintf(ipbuf, sizeof(ipbuf)-1, "%s", name_or_ip); + ptr = strrchr(ipbuf, '/'); if(ptr) ptr[0] = '\0'; -- cgit v1.2.3