diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-02-21 20:30:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 20:30:22 +0100 |
commit | 6c1accd2bdca957b0979707b7f789ae8b5a63334 (patch) | |
tree | 902ca2cbec83252dd9b758deac9f859491a22ea6 /src/lib/protocols | |
parent | 59993e294eb20d84db1a42b59cbd0f3be03d1400 (diff) |
DTLS: fix access to certificate cache (#1450)
```
protocols/tls.c:650:54: runtime error: member access within null pointer of type 'const struct ndpi_tcphdr'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior protocols/tls.c:650:54 in
protocols/tls.c:650:54: runtime error: load of null pointer of type 'const u_int16_t' (aka 'const unsigned short')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior protocols/tls.c:650:54 in
AddressSanitizer:DEADLYSIGNAL
=================================================================
==47401==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55f7a61b661c bp 0x7f38190f91b0 sp 0x7f38190f70e0 T1)
==47401==The signal is caused by a READ memory access.
==47401==Hint: address points to the zero page.
#0 0x55f7a61b661c in processCertificateElements /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:650:41
#1 0x55f7a61ac3cc in processCertificate /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:792:7
#2 0x55f7a61d34e1 in processTLSBlock /home/ivan/svnrepos/nDPI/src/lib/protocols/tls.c:846:13
```
Diffstat (limited to 'src/lib/protocols')
-rw-r--r-- | src/lib/protocols/tls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 1ab3dd85c..8214ede04 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -646,7 +646,7 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi if(ndpi_struct->tls_cert_cache == NULL) ndpi_struct->tls_cert_cache = ndpi_lru_cache_init(1024); - if(ndpi_struct->tls_cert_cache && packet->iph) { + if(ndpi_struct->tls_cert_cache && packet->iph && packet->tcp) { u_int32_t key = packet->iph->saddr + packet->tcp->source; /* Server */ ndpi_lru_add_to_cache(ndpi_struct->tls_cert_cache, key, proto_id); |