diff options
author | Campus <campus@ntop.org> | 2016-03-10 11:44:24 +0100 |
---|---|---|
committer | Campus <campus@ntop.org> | 2016-03-10 11:44:24 +0100 |
commit | 7ae06a114df358010c27cdf5819d1abdadd099fb (patch) | |
tree | 527d6fc3e841f7a9719c1c56117dd9690dc9645a /src/lib/ndpi_main.c | |
parent | 8321b2fa66bb58fa85c36586b21deae8449d6465 (diff) |
added check_punycode_string for issue https://github.com/ntop/nDPI/issues/157
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 1b9d4c1f6..bafada4d4 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -38,6 +38,25 @@ #include "third_party/include/ndpi_patricia.h" #include "third_party/src/ndpi_patricia.c" + +/* implementation of the punycode check function */ +int check_punycode_string(char * buffer , int len) +{ + int i = 0; + + while(i++ < len) + { + if( buffer[i] == 'x' && + buffer[i+1] == 'n' && + buffer[i+2] == '-' && + buffer[i+3] == '-' ) + // is a punycode string + return 1; + } + // not a punycode string + return 0; +} + /* ftp://ftp.cc.uoc.gr/mirrors/OpenBSD/src/lib/libc/stdlib/tsearch.c */ /* find or insert datum into search tree */ void * |