From 961bc71e5333351e4487672c27addbb00ba8e78e Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Sun, 11 Sep 2022 17:49:57 +0200 Subject: [PATCH] STUN: fix calculation of CRC-32 with TCP framing According to RFC 8489: Sec 1: "All STUN messages start with a fixed header that includes a method, a class, and the transaction ID". Sec 14.7: "The value of the attribute is computed as the CRC-32 of the STUN message up to (but excluding) the FINGERPRINT attribute itself". Even if the RFCs are not cristal clear, it seems that the "TCP Stream length" field (described in RFC 4571) should be excluded from the CRC-32 calculation. --- epan/dissectors/packet-stun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index cc620cf8de..3b0da9ee24 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -1537,7 +1537,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole case FINGERPRINT: if (att_length < 4) break; - proto_tree_add_checksum(att_tree, tvb, offset, hf_stun_att_crc32, hf_stun_att_crc32_status, &ei_stun_fingerprint_bad, pinfo, crc32_ccitt_tvb(tvb, offset-4) ^ 0x5354554e, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(att_tree, tvb, offset, hf_stun_att_crc32, hf_stun_att_crc32_status, &ei_stun_fingerprint_bad, pinfo, crc32_ccitt_tvb_offset(tvb, tcp_framing_offset, offset-4-tcp_framing_offset) ^ 0x5354554e, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); break; case ICE_CONTROLLED: