RTCP: Extended Reports: check for padding

Check if padding flag is set and alter length accordingly.
Display rtcp.xr.bl the same way as rtcp.length.

Fixes: wireshark/wireshark#16933
This commit is contained in:
Uli Heilmeier 2020-10-28 22:01:47 +01:00 committed by Wireshark GitLab Utility
parent 07df04e4c7
commit e07bb433b2
1 changed files with 10 additions and 2 deletions

View File

@ -3161,6 +3161,7 @@ static gboolean validate_xr_block_length(tvbuff_t *tvb, packet_info *pinfo, int
proto_item *ti;
ti = proto_tree_add_uint(tree, hf_rtcp_xr_block_length, tvb, offset, 2, block_len);
proto_item_append_text(ti, " (%u bytes)", (block_len)*4);
switch (block_type) {
case RTCP_XR_REF_TIME:
if (block_len != 2)
@ -3190,7 +3191,7 @@ static gboolean validate_xr_block_length(tvbuff_t *tvb, packet_info *pinfo, int
}
static int
dissect_rtcp_xr(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, gint packet_len)
dissect_rtcp_xr(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, unsigned int padding, gint packet_len)
{
guint block_num;
@ -3200,6 +3201,13 @@ dissect_rtcp_xr(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree,
return offset + packet_len;
}
if (padding) {
/* If there's padding present, we have to remove that from the data part
* The last octet of the packet contains the length of the padding
*/
packet_len -= tvb_get_guint8(tvb, offset + packet_len - 1);
}
/* SSRC */
proto_tree_add_item( tree, hf_rtcp_ssrc_sender, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
@ -4456,7 +4464,7 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
offset++;
/* Packet length in 32 bit words MINUS one, 16 bits */
offset = dissect_rtcp_length_field(rtcp_tree, tvb, offset);
offset = dissect_rtcp_xr( tvb, pinfo, offset, rtcp_tree, packet_length - 4 );
offset = dissect_rtcp_xr( tvb, pinfo, offset, rtcp_tree, padding_set, packet_length - 4 );
break;
case RTCP_AVB:
/* Subtype, 5 bits */