aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilippe Antoine <contact@catenacyber.fr>2020-02-26 17:12:46 +0100
committerPhilippe Antoine <contact@catenacyber.fr>2020-02-26 17:12:46 +0100
commit6fe95358812323fcf614fba8f8e5a43f43d164bb (patch)
treeb8c62970596456666cb91a1a79a0ae07cf933ab3 /src
parent5fc9d41eb0b337958fb7c7446ca690f8ba361285 (diff)
Adds check before memcpy for bittorrent
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/bittorrent.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/protocols/bittorrent.c b/src/lib/protocols/bittorrent.c
index a1ade79b2..d0773e43a 100644
--- a/src/lib/protocols/bittorrent.c
+++ b/src/lib/protocols/bittorrent.c
@@ -72,7 +72,7 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
} else
bt_hash = (const char*)&flow->packet.payload[28];
- if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
+ if(bt_hash && flow->packet.payload_packet_len >= 20 + (bt_hash-flow->packet.payload)) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
}
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);