From 8575a071133ef312686cbeb88daf6e5fdb38bb7c Mon Sep 17 00:00:00 2001
From: Luca Deri <deri@ntop.org>
Date: Mon, 31 Aug 2020 17:23:00 +0200
Subject: Added check for ndpi_ssl_version2str()

---
 src/lib/ndpi_utils.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 5cd351ba9..cd72bf4f3 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -716,7 +716,9 @@ int ndpi_has_human_readeable_string(struct ndpi_detection_module_struct *ndpi_st
 
 char* ndpi_ssl_version2str(struct ndpi_flow_struct *flow,
                            u_int16_t version, u_int8_t *unknown_tls_version) {
-  *unknown_tls_version = 0;
+
+  if(unknown_tls_version)
+    *unknown_tls_version = 0;
 
   switch(version) {
   case 0x0300: return("SSLv3");
@@ -748,7 +750,8 @@ char* ndpi_ssl_version2str(struct ndpi_flow_struct *flow,
   if((version >= 0x7f00) && (version <= 0x7fff))
     return("TLSv1.3 (draft)");
 
-  *unknown_tls_version = 1;
+  if(unknown_tls_version)
+    *unknown_tls_version = 1;
 
   if(flow != NULL) {
     snprintf(flow->protos.stun_ssl.ssl.ssl_version_str,
-- 
cgit v1.2.3