Fixed heap overflow in tls esni extraction triggered by manipulated packets.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2020-06-29 21:51:46 +02:00
parent 0d2d44f1b6
commit 05d7400563
3 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -1298,7 +1298,8 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
e_sni_len = ntohs(*((u_int16_t*)&packet->payload[e_offset]));
e_offset += 2;
if((e_offset+e_sni_len-extension_len-initial_offset) >= 0) {
if((e_offset+e_sni_len-extension_len-initial_offset) >= 0 &&
e_offset+e_sni_len < packet->payload_packet_len) {
#ifdef DEBUG_ENCRYPTED_SNI
printf("Client SSL [Encrypted Server Name len: %u]\n", e_sni_len);
#endif