diff options
author | Luca Deri <deri@ntop.org> | 2020-02-28 15:28:41 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2020-02-28 15:28:41 +0100 |
commit | 8f45f51e6ccb8b3bf65edc2f1252da1a1dad24df (patch) | |
tree | 0eea63ed8ee589e366d658aad8ba910d4274975c /src | |
parent | 9f72b15fffe21257910490ade8fb908659b01f54 (diff) |
Compilation fix
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/protocols/bittorrent.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/protocols/bittorrent.c b/src/lib/protocols/bittorrent.c index d0773e43a..f1c62d431 100644 --- a/src/lib/protocols/bittorrent.c +++ b/src/lib/protocols/bittorrent.c @@ -62,7 +62,7 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc { if(check_hash) { const char *bt_hash = NULL; /* 20 bytes long */ - + if(bt_offset == -1) { const char *bt_magic = ndpi_strnstr((const char *)flow->packet.payload, "BitTorrent protocol", flow->packet.payload_packet_len); @@ -72,7 +72,8 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc } else bt_hash = (const char*)&flow->packet.payload[28]; - if(bt_hash && flow->packet.payload_packet_len >= 20 + (bt_hash-flow->packet.payload)) memcpy(flow->protos.bittorrent.hash, bt_hash, 20); + if(bt_hash && (flow->packet.payload_packet_len >= (20 + (bt_hash-(const char*)flow->packet.payload)))) + memcpy(flow->protos.bittorrent.hash, bt_hash, 20); } ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN); |