aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2017-08-29 19:56:32 +0200
committerLuca <deri@ntop.org>2017-08-29 19:56:32 +0200
commit299b9435d0948c822d8aa7b129619c91a2b58138 (patch)
treebb4d2ec1d4d1a3891032faaaeebec3c82a2fe295 /src/lib/protocols
parenta1367a9d395da68a5069d7e368843d35de0c19b6 (diff)
Fixed memory out-of-bound issue
Added extra check for fixing #366
Diffstat (limited to 'src/lib/protocols')
-rw-r--r--src/lib/protocols/fasttrack.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/protocols/fasttrack.c b/src/lib/protocols/fasttrack.c
index cb2f20343..c432f6754 100644
--- a/src/lib/protocols/fasttrack.c
+++ b/src/lib/protocols/fasttrack.c
@@ -42,7 +42,9 @@ void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct,
// struct ndpi_id_struct *src=ndpi_struct->src;
// struct ndpi_id_struct *dst=ndpi_struct->dst;
- if (packet->payload_packet_len > 6 && ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a) {
+ if ( (packet->payload != NULL)
+ && (packet->payload_packet_len > 6)
+ && (ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a)) {
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "detected 0d0a at the end of the packet.\n");
if (memcmp(packet->payload, "GIVE ", 5) == 0 && packet->payload_packet_len >= 8) {