diff options
author | emanuele-f <faranda@ntop.org> | 2020-02-13 10:46:30 +0100 |
---|---|---|
committer | emanuele-f <faranda@ntop.org> | 2020-02-13 10:46:30 +0100 |
commit | d4ae8a5f164167ef4fcf5b76b743e92b9e76d9dd (patch) | |
tree | c6887a16ba4c4579cbf5fc0492e97cad001a0a56 /src/lib/protocols/tls.c | |
parent | 7234f369499e02f44efcbbf0efe43bae596ddc53 (diff) |
Fix memory invalid access in SMTP and leaks in TLS
Diffstat (limited to 'src/lib/protocols/tls.c')
-rw-r--r-- | src/lib/protocols/tls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 1b120dc7b..aa273f535 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -483,8 +483,12 @@ static int processTLSBlock(struct ndpi_detection_module_struct *ndpi_struct, break; case 0x0b: /* Certificate */ - processCertificate(ndpi_struct, flow); - flow->l4.tcp.tls.certificate_processed = 1; + /* Important: populate the tls union fields only after + * ndpi_int_tls_add_connection has been called */ + if(flow->l4.tcp.tls.hello_processed) { + processCertificate(ndpi_struct, flow); + flow->l4.tcp.tls.certificate_processed = 1; + } break; default: |