If an item in a source description chunk begins with 4 bytes of zero,

that doesn't mean it's padding at the end of a previous item - it might,
for example, be the *first* item in the chunk.  Don't treat it as
padding.

Do, however, treat an item that begins with a zero byte as an item, but
break out of the loop processing items as soon as the item type is put
into the protocol tree, as there's no length field or data in an
RTCP_SDES_END item.  Fix the comment for that loop to indicate that the
loop checks both for end-of-frame and for an RTCP_SDES_END item.

svn path=/trunk/; revision=13040
This commit is contained in:
Guy Harris 2005-01-14 19:28:02 +00:00
parent e7fd062619
commit 766b213ed6
1 changed files with 7 additions and 16 deletions

View File

@ -633,19 +633,6 @@ dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
start_offset = offset;
ssrc = tvb_get_ntohl( tvb, offset );
if (ssrc == 0) {
/* According to RFC1889 section 6.4:
* "The list of items in each chunk is terminated by one or more
* null octets, the first of which is interpreted as an item type
* of zero to denote the end of the list, and the remainder as
* needed to pad until the next 32-bit boundary.
*
* A chunk with zero items (four null octets) is valid but useless."
*/
proto_tree_add_text(tree, tvb, offset, 4, "Padding");
offset += 4;
continue;
}
sdes_item = proto_tree_add_text(tree, tvb, offset, -1,
"Chunk %u, SSRC/CSRC %u", chunk, ssrc);
sdes_tree = proto_item_add_subtree( sdes_item, ett_sdes );
@ -663,15 +650,19 @@ dissect_rtcp_sdes( tvbuff_t *tvb, int offset, proto_tree *tree,
/*
* Not every message is ended with "null" bytes, so check for
* end of frame instead.
* end of frame as well.
*/
while ( ( tvb_reported_length_remaining( tvb, offset ) > 0 )
&& ( tvb_get_guint8( tvb, offset ) != RTCP_SDES_END ) ) {
while ( tvb_reported_length_remaining( tvb, offset ) > 0 ) {
/* ID, 8 bits */
sdes_type = tvb_get_guint8( tvb, offset );
proto_tree_add_item( sdes_item_tree, hf_rtcp_ssrc_type, tvb, offset, 1, FALSE );
offset++;
if ( sdes_type == RTCP_SDES_END ) {
/* End of list */
break;
}
/* Item length, 8 bits */
item_len = tvb_get_guint8( tvb, offset );
proto_tree_add_item( sdes_item_tree, hf_rtcp_ssrc_length, tvb, offset, 1, FALSE );