diff options
author | emanuele-f <faranda@ntop.org> | 2019-12-04 14:21:04 +0100 |
---|---|---|
committer | emanuele-f <faranda@ntop.org> | 2019-12-04 14:21:04 +0100 |
commit | 2b3ef7e7622c51641e9e88fa76442cda086982fd (patch) | |
tree | a9ccaf3fdf11f860d1aa9089ecea13d3d75b0437 /src/lib/protocols/tls.c | |
parent | d62526f9ed0d504c928a3861b4838f7029bc0632 (diff) |
Fix invalid memory access
Diffstat (limited to 'src/lib/protocols/tls.c')
-rw-r--r-- | src/lib/protocols/tls.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 23c47d7cd..cd729fc3c 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -308,7 +308,11 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct, #endif offset += 2 + 1; - extension_len = ntohs(*((u_int16_t*)&packet->payload[offset])); + + if(offset > packet->payload_packet_len) + extension_len = ntohs(*((u_int16_t*)&packet->payload[offset])); + else + extension_len = 0; #ifdef DEBUG_TLS printf("TLS [server][extension_len: %u]\n", extension_len); |