aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2024-10-13 20:45:20 +0200
committerLuca Deri <deri@ntop.org>2024-10-13 20:45:20 +0200
commit2b4061108215304c131aea314229719975c8f1d9 (patch)
treed68344be661260edbd39aa3c749bcb87aa86c3fa /src
parentad9c5744f7018e148343790e0c3576671d88cb84 (diff)
Fixed JA4 invalid computation due to code bug and uninitialized values
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/tls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c
index 3b9aff4e7..74e7da64f 100644
--- a/src/lib/protocols/tls.c
+++ b/src/lib/protocols/tls.c
@@ -2104,7 +2104,7 @@ static void ndpi_compute_ja4(struct ndpi_detection_module_struct *ndpi_struct,
rc = ndpi_snprintf(&ja_str[ja_str_len], ja_max_len - ja_str_len, "%02u%02u%c%c_",
ja->client.num_ciphers, ja->client.num_tls_extensions,
(ja->client.alpn[0] == '\0') ? '0' : ja->client.alpn[0],
- (ja->client.alpn[0] == '\0') ? '0' : ja->client.alpn[1]);
+ (ja->client.alpn[1] == '\0') ? '0' : ja->client.alpn[1]);
if((rc > 0) && (ja_str_len + rc < JA_STR_LEN)) ja_str_len += rc;
/* Sort ciphers and extensions */
@@ -2499,7 +2499,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
ja.client.num_signature_algorithms = 0;
ja.client.num_supported_versions = 0;
ja.client.signature_algorithms_str[0] = '\0';
- ja.client.alpn[0] = '\0';
+ ja.client.alpn[0] = '\0', ja.client.alpn[1] = '\0' /* used by JA4 */;
flow->protos.tls_quic.ssl_version = ja.client.tls_handshake_version = tls_version;
if(flow->protos.tls_quic.ssl_version < 0x0303) /* < TLSv1.2 */ {