diff options
author | Luca Deri <deri@ntop.org> | 2019-12-09 00:29:02 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-12-09 00:29:02 +0100 |
commit | c4d476cc583a2ef1e9814134efa4fbf484564ed7 (patch) | |
tree | f6a1c8dc478efcd0037e812ff37ea89ab0c31021 /src/lib/ndpi_utils.c | |
parent | 23b0b8625d1f20596b2b20a149fb28c38046f4e1 (diff) |
Code improvements
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 9b0339c3c..3637561d0 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1063,9 +1063,12 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, ndpi_serialize_string_string(serializer, "cipher", ndpi_cipher2str(flow->protos.stun_ssl.ssl.server_cipher)); if(flow->l4.tcp.tls_sha1_certificate_fingerprint[0] != '\0') { - for(i=0, off=0; i<20; i++) - off += snprintf(&buf[off], sizeof(buf)-off,"%s%02X", (i > 0) ? ":" : "", - flow->l4.tcp.tls_sha1_certificate_fingerprint[i] & 0xFF); + for(i=0, off=0; i<20; i++) { + int rc = snprintf(&buf[off], sizeof(buf)-off,"%s%02X", (i > 0) ? ":" : "", + flow->l4.tcp.tls_sha1_certificate_fingerprint[i] & 0xFF); + + if(rc <= 0) break; else off += rc; + } ndpi_serialize_string_string(serializer, "fingerprint", buf); } |