QUIC: fix heuristic

In the heuristic function we don't know the length of the CID in the short
header, so we assume the worst case scenario compatible with packet length
(no more than 20 bytes)
This commit is contained in:
Nardi Ivan 2020-10-13 20:26:47 +02:00 committed by Peter Wu
parent d6a9bfa503
commit baebbbce4d
1 changed files with 2 additions and 2 deletions

View File

@ -3136,8 +3136,8 @@ dissect_quic_short_header_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
}
// DCID length is unknown, so extract the maximum and look for a match.
quic_cid_t dcid = {.len=QUIC_MAX_CID_LENGTH};
tvb_memcpy(tvb, dcid.cid, 1, QUIC_MAX_CID_LENGTH);
quic_cid_t dcid = {.len = MIN(QUIC_MAX_CID_LENGTH, tvb_captured_length(tvb) - 1 - 1 - 16)};
tvb_memcpy(tvb, dcid.cid, 1, dcid.len);
gboolean from_server;
if (!quic_connection_find(pinfo, QUIC_SHORT_PACKET, &dcid, &from_server)) {
return FALSE;