aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-04-12 19:33:17 +0200
committerLuca Deri <deri@ntop.org>2019-04-12 19:33:17 +0200
commit1bf9351a6768cdd9bbaa345be0c5031cbf45d684 (patch)
treeaad2e1f10c637f6ce497bc17dc9980bf5bca900e /src/lib/protocols
parent3cb0b3fc7b2cb5056c74f2403693557e00757931 (diff)
parentffb1b9c14fccb6b29d2e829362cd0c469db8e9a4 (diff)
Merge branch 'dev' of https://github.com/ntop/nDPI into dev
Diffstat (limited to 'src/lib/protocols')
-rw-r--r--src/lib/protocols/csgo.c5
-rw-r--r--src/lib/protocols/http.c2
-rw-r--r--src/lib/protocols/memcached.c3
3 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/protocols/csgo.c b/src/lib/protocols/csgo.c
index 7f4479419..f316f96b7 100644
--- a/src/lib/protocols/csgo.c
+++ b/src/lib/protocols/csgo.c
@@ -30,6 +30,11 @@ void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct n
struct ndpi_packet_struct* packet = &flow->packet;
if (packet->udp != NULL) {
+ if (packet->payload_packet_len < sizeof(uint32_t)) {
+ NDPI_LOG_DBG2(ndpi_struct, "Short csgo packet\n");
+ return;
+ }
+
uint32_t w = htonl(get_u_int32_t(packet->payload, 0));
NDPI_LOG_DBG2(ndpi_struct, "CSGO: word %08x\n", w);
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 33ef9e2ed..e715dd499 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -184,6 +184,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
case 'P':
switch(flow->packet.http_method.ptr[1]) {
+ case 'A': flow->http.method = NDPI_HTTP_METHOD_PATCH; break;
case 'O': flow->http.method = NDPI_HTTP_METHOD_POST; break;
case 'U': flow->http.method = NDPI_HTTP_METHOD_PUT; break;
}
@@ -414,6 +415,7 @@ static struct l_string {
STATIC_STRING_L("OPTIONS "),
STATIC_STRING_L("HEAD "),
STATIC_STRING_L("PUT "),
+ STATIC_STRING_L("PATCH "),
STATIC_STRING_L("DELETE "),
STATIC_STRING_L("CONNECT "),
STATIC_STRING_L("PROPFIND "),
diff --git a/src/lib/protocols/memcached.c b/src/lib/protocols/memcached.c
index e9deb5cc9..44a8b0858 100644
--- a/src/lib/protocols/memcached.c
+++ b/src/lib/protocols/memcached.c
@@ -89,7 +89,7 @@
#define MEMCACHED_MIN_MATCH 2 /* Minimum number of command/responses required */
-#define MEMCACHED_MATCH(cr) memcmp(offset, cr, cr ## _LEN)
+#define MEMCACHED_MATCH(cr) (cr ## _LEN > length || memcmp(offset, cr, cr ## _LEN))
static void ndpi_int_memcached_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow)
@@ -105,6 +105,7 @@ void ndpi_search_memcached(
{
struct ndpi_packet_struct *packet = &flow->packet;
const u_int8_t *offset = packet->payload;
+ const u_int16_t length = packet->payload_packet_len;
u_int8_t *matches;
NDPI_LOG_DBG(ndpi_struct, "search memcached\n");