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.c8
1 files changed, 4 insertions, 4 deletions
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';