diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2020-03-31 17:51:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 17:51:20 +0200 |
commit | 56ca71bda9870e78ba0ee70fe226c4a4fcc36a04 (patch) | |
tree | a523d39c9ee5faa35067fc8a4122ba2b6f51883c /src/lib/protocols/openvpn.c | |
parent | 17d531e3db61326f286c7d0d543f4ea5b00bc796 (diff) | |
parent | 498571354d2c22c192bb80bc79058b70d455b363 (diff) |
Merge pull request #863 from IvanNardi/memory-errors
Memory errors
Diffstat (limited to 'src/lib/protocols/openvpn.c')
-rw-r--r-- | src/lib/protocols/openvpn.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/protocols/openvpn.c b/src/lib/protocols/openvpn.c index e18774fff..2753dd02e 100644 --- a/src/lib/protocols/openvpn.c +++ b/src/lib/protocols/openvpn.c @@ -120,19 +120,22 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct, if(hmac_size > 0) { alen = ovpn_payload[P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size)]; - session_remote = ovpn_payload + P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) + 1 + alen * 4; - - if(memcmp(flow->ovpn_session_id, session_remote, 8) == 0) { - NDPI_LOG_INFO(ndpi_struct,"found openvpn\n"); - ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN); - return; - } else { - NDPI_LOG_DBG2(ndpi_struct, + if (alen > 0) { + session_remote = ovpn_payload + P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) + 1 + alen * 4; + + if(memcmp(flow->ovpn_session_id, session_remote, 8) == 0) { + NDPI_LOG_INFO(ndpi_struct,"found openvpn\n"); + ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN); + return; + } else { + NDPI_LOG_DBG2(ndpi_struct, "key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\n", session_remote[0], session_remote[1], session_remote[2], session_remote[3], session_remote[4], session_remote[5], session_remote[6], session_remote[7]); + failed = 1; + } + } else failed = 1; - } } else failed = 1; } else |