Check to avoid allocating twice the esni memory

This commit is contained in:
Luca Deri
2020-06-01 16:34:24 +02:00
parent 29d9c2d2c8
commit 16dc0ec29e
+2
View File
@@ -1288,6 +1288,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
printf("Client SSL [Encrypted Server Name len: %u]\n", e_sni_len); printf("Client SSL [Encrypted Server Name len: %u]\n", e_sni_len);
#endif #endif
if(flow->protos.stun_ssl.ssl.encrypted_sni.esni == NULL) {
flow->protos.stun_ssl.ssl.encrypted_sni.esni = (char*)ndpi_malloc(e_sni_len*2+1); flow->protos.stun_ssl.ssl.encrypted_sni.esni = (char*)ndpi_malloc(e_sni_len*2+1);
if(flow->protos.stun_ssl.ssl.encrypted_sni.esni) { if(flow->protos.stun_ssl.ssl.encrypted_sni.esni) {
@@ -1307,6 +1308,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
} }
} }
} }
}
extension_offset += extension_len; /* Move to the next extension */ extension_offset += extension_len; /* Move to the next extension */