diff options
author | Michele Campus <fci1908@gmail.com> | 2016-04-12 23:41:02 +0200 |
---|---|---|
committer | Michele Campus <fci1908@gmail.com> | 2016-04-12 23:41:02 +0200 |
commit | da811fbdd0023a0a3dc3f810029ef92e83e1f781 (patch) | |
tree | 5e75a520f4c2f12ab85b22914f15c8f0857f132e /src/lib/ndpi_main.c | |
parent | 885cc3864eccaa0eaadff7233f5a6a94c4239e24 (diff) | |
parent | d7a2515093ce64d29020c0768956c6ead1ae23da (diff) |
Merge pull request #173 from theirix/buffer-overflows
Fixed multiple buffer overflows
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 845c56c63..8fe3a54d7 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -4339,6 +4339,16 @@ char* ndpi_strnstr(const char *s, const char *find, size_t slen) { /* ****************************************************** */ +int ndpi_match_prefix(const u_int8_t *payload, size_t payload_len, + const char *str, size_t str_len) +{ + return str_len <= payload_len + ? memcmp(payload, str, str_len) == 0 + : 0; +} + +/* ****************************************************** */ + int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_struct, char *string_to_match, u_int string_to_match_len, u_int8_t is_host_match) { |