From c530cd35dbb01340cbdd1ca659396e05edecacae Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 22 Dec 2003 23:43:35 +0000 Subject: Call subdissectors even if we're not building a protocol tree. In the loop that processes TCP segment data, loop over the full reported length of the segment, so that we throw an exception if the frame was short. svn path=/trunk/; revision=9420 --- packet-rtsp.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'packet-rtsp.c') diff --git a/packet-rtsp.c b/packet-rtsp.c index 4e841914e0..2dc08f5067 100644 --- a/packet-rtsp.c +++ b/packet-rtsp.c @@ -4,7 +4,7 @@ * Jason Lango * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-rtsp.c,v 1.53 2003/12/22 23:37:02 guy Exp $ + * $Id: packet-rtsp.c,v 1.54 2003/12/22 23:43:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -110,8 +110,8 @@ dissect_rtspinterleaved(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint length_remaining; - proto_tree *rtspframe_tree; proto_item *ti; + proto_tree *rtspframe_tree = NULL; int orig_offset; guint8 rf_start; /* always RTSP_FRAMEHDR */ guint8 rf_chan; /* interleaved channel id */ @@ -181,32 +181,31 @@ dissect_rtspinterleaved(tvbuff_t *tvb, int offset, packet_info *pinfo, "Interleaved channel 0x%02x, %u bytes", rf_chan, rf_len); - if (tree == NULL) { - /* - * We're not building a full protocol tree; all we care - * about is setting the column info. - */ - return -1; - } - - ti = proto_tree_add_protocol_format(tree, proto_rtsp, tvb, offset, 4, - "RTSP Interleaved Frame, Channel: 0x%02x, %u bytes", - rf_chan, rf_len); - rtspframe_tree = proto_item_add_subtree(ti, ett_rtspframe); + if (tree != NULL) { + ti = proto_tree_add_protocol_format(tree, proto_rtsp, tvb, + offset, 4, + "RTSP Interleaved Frame, Channel: 0x%02x, %u bytes", + rf_chan, rf_len); + rtspframe_tree = proto_item_add_subtree(ti, ett_rtspframe); - proto_tree_add_text(rtspframe_tree, tvb, offset, 1, - "Magic: 0x%02x", - rf_start); + proto_tree_add_text(rtspframe_tree, tvb, offset, 1, + "Magic: 0x%02x", + rf_start); + } offset += 1; - proto_tree_add_text(rtspframe_tree, tvb, offset, 1, - "Channel: 0x%02x", - rf_chan); + if (tree != NULL) { + proto_tree_add_text(rtspframe_tree, tvb, offset, 1, + "Channel: 0x%02x", + rf_chan); + } offset += 1; - proto_tree_add_text(rtspframe_tree, tvb, offset, 2, - "Length: %u bytes", - rf_len); + if (tree != NULL) { + proto_tree_add_text(rtspframe_tree, tvb, offset, 2, + "Length: %u bytes", + rf_len); + } offset += 2; /* @@ -869,7 +868,7 @@ dissect_rtsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO); - while (tvb_offset_exists(tvb, offset)) { + while (tvb_reported_length_remaining(tvb, offset) != 0) { len = (tvb_get_guint8(tvb, offset) == RTSP_FRAMEHDR) ? dissect_rtspinterleaved(tvb, offset, pinfo, tree) : dissect_rtspmessage(tvb, offset, pinfo, tree); -- cgit v1.2.3