diff options
author | Luca Deri <deri@ntop.org> | 2019-07-17 15:31:48 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-07-17 15:31:48 +0200 |
commit | 9ca87a620a39dbec76e28ea9ebe149c62de5b011 (patch) | |
tree | 4530e16576d641432343ecec98ffa36be93ffb94 /src/lib/ndpi_main.c | |
parent | b54863edc6a410296424314848a98ecad0472dd2 (diff) |
Added extar check
Warning fix
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 8 |
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'; |