aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoremanuele-f <black.silver@hotmail.it>2019-10-08 11:59:20 +0200
committeremanuele-f <black.silver@hotmail.it>2019-10-08 11:59:20 +0200
commit2dfdaa4d703ae2e7d88c72c5a1bd9ca3f8258ce9 (patch)
treedae2f3e346fa0d37ccd857914d01eb97913e6d86 /src
parentf2504494fed30da9b941e791af0cb67823000b2d (diff)
Replace strtok with reentrant version
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c8
1 files changed, 5 insertions, 3 deletions
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("");
}
/* ******************************************************************** */