aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2015-07-16 21:01:30 +0200
committerLuca Deri <deri@ntop.org>2015-07-16 21:01:30 +0200
commit73358d5ec2f877ca30ac0b20c12530d1f338ca5b (patch)
tree806739a3e98157ca12a88fb01a29304c0ce3c0f0
parente98108a8bed046a68d907c5f4206d0a47ff486e2 (diff)
Added check for removing characters from nDPI custom-defined protocols that might cause apps to misbehave.
-rw-r--r--example/protos.txt2
-rw-r--r--src/lib/ndpi_main.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/example/protos.txt b/example/protos.txt
index de7dc1c40..4c995f543 100644
--- a/example/protos.txt
+++ b/example/protos.txt
@@ -13,7 +13,7 @@ tcp:3000@ntop
host:"googlesyndacation.com"@Google
host:"venere.com"@Venere
host:"kataweb.it",host:"repubblica.it"@Repubblica
-
+host:"ntop"@ntop
# IP based Subprotocols
# Format:
# ip:<value>,ip:<value>,.....@<subproto>
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 9807183ba..0623433bb 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -2000,6 +2000,21 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_mod, char* rule,
} else
at[0] = 0, proto = &at[1];
+ for(i=0; proto[i] != '\0'; i++) {
+ switch(proto[i]) {
+ case '/':
+ case '&':
+ case '^':
+ case ':':
+ case ';':
+ case '\'':
+ case '"':
+ case ' ':
+ proto[i] = '_';
+ break;
+ }
+ }
+
for(i=0, def = NULL; i<(int)ndpi_mod->ndpi_num_supported_protocols; i++) {
if(strcasecmp(ndpi_mod->proto_defaults[i].protoName, proto) == 0) {
def = &ndpi_mod->proto_defaults[i];