From 2dfdaa4d703ae2e7d88c72c5a1bd9ca3f8258ce9 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Tue, 8 Oct 2019 11:59:20 +0200 Subject: Replace strtok with reentrant version --- src/lib/ndpi_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index bd5321e2c..53ebff590 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -2707,7 +2707,7 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_str, * - empty lines or lines starting with # are ignored */ int ndpi_load_categories_file(struct ndpi_detection_module_struct *ndpi_str, const char* path) { - char buffer[512], *line, *name, *category; + char buffer[512], *line, *name, *category, *saveptr; FILE *fd; int len; @@ -2730,10 +2730,10 @@ int ndpi_load_categories_file(struct ndpi_detection_module_struct *ndpi_str, con continue; line[len-1] = '\0'; - name = strtok(line, "\t"); + name = strtok_r(line, "\t", &saveptr); if(name) { - category = strtok(NULL, "\t"); + category = strtok_r(NULL, "\t", &saveptr); if(category) ndpi_load_category(ndpi_str, name, (ndpi_protocol_category_t) atoi(category)); @@ -6483,6 +6483,8 @@ const char* ndpi_get_l4_proto_name(ndpi_l4_proto_info proto) { return("TCP/UDP"); break; } + + return(""); } /* ******************************************************************** */ -- cgit v1.2.3