From a4d560eb5b9bfa822097cbed09e3d30ed9f98263 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 10 Jan 2002 22:21:14 +0000 Subject: [PATCH] From Nagarjuna Venna: only display the reason in BYE RTCP packets if it's present. svn path=/trunk/; revision=4518 --- AUTHORS | 4 ++++ doc/ethereal.pod.template | 1 + packet-rtcp.c | 26 ++++++++++++++------------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/AUTHORS b/AUTHORS index c4aa62c3c0..5935043752 100644 --- a/AUTHORS +++ b/AUTHORS @@ -987,6 +987,10 @@ Dinesh Dutt { SCSI dissector, for use by iSCSI and other protocols that transport SCSI operations } + +Nagarjuna Venna { + Only display the reason in BYE RTCP packets if it's present +} Alain Magloire was kind enough to give his permission to use his version of snprintf.c. diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index d051eae9ce..cdedd603ff 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -1278,6 +1278,7 @@ B. Irfan Khan Jayaram V.R Dinesh Dutt + Nagarjuna Venna Alain Magloire was kind enough to give his permission to use his version of snprintf.c. diff --git a/packet-rtcp.c b/packet-rtcp.c index 1f8770e452..9062fb4ab4 100644 --- a/packet-rtcp.c +++ b/packet-rtcp.c @@ -1,6 +1,6 @@ /* packet-rtcp.c * - * $Id: packet-rtcp.c,v 1.27 2001/12/10 00:25:33 guy Exp $ + * $Id: packet-rtcp.c,v 1.28 2002/01/10 22:21:13 guy Exp $ * * Routines for RTCP dissection * RTCP = Real-time Transport Control Protocol @@ -386,18 +386,20 @@ dissect_rtcp_bye( tvbuff_t *tvb, int offset, frame_data *fd, proto_tree *tree, offset += 4; } - /* Bye reason consists of an 8 bit length l and a string with length l */ - reason_length = tvb_get_guint8( tvb, offset ); - proto_tree_add_item( tree, hf_rtcp_ssrc_length, tvb, offset, 1, FALSE ); - offset++; + if ( tvb_reported_length_remaining( tvb, offset ) > 0 ) { + /* Bye reason consists of an 8 bit length l and a string with length l */ + reason_length = tvb_get_guint8( tvb, offset ); + proto_tree_add_item( tree, hf_rtcp_ssrc_length, tvb, offset, 1, FALSE ); + offset++; - reason_text = ( char* ) malloc( reason_length + 1 ); - for ( counter = 0; counter < reason_length; counter++ ) reason_text[ counter ] = tvb_get_guint8( tvb, offset + counter ); - /* strncpy( reason_text, pd + offset, reason_length ); */ - reason_text[ reason_length ] = '\0'; - proto_tree_add_string( tree, hf_rtcp_ssrc_text, tvb, offset, reason_length, reason_text ); - free( reason_text ); - offset += reason_length; + reason_text = ( char* ) malloc( reason_length + 1 ); + for ( counter = 0; counter < reason_length; counter++ ) reason_text[ counter ] = tvb_get_guint8( tvb, offset + counter ); + /* strncpy( reason_text, pd + offset, reason_length ); */ + reason_text[ reason_length ] = '\0'; + proto_tree_add_string( tree, hf_rtcp_ssrc_text, tvb, offset, reason_length, reason_text ); + free( reason_text ); + offset += reason_length; + } return offset;