From 71fe1344d577c190ebe72205996e67a6b0b4779c Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Mon, 29 Dec 2014 14:20:44 -0500 Subject: [PATCH] rtsp: Fix (what I think may be) a minor bug. (Also fixes a compiler 'Shadow' warning in a different way than the now reverted previous fix). Change-Id: Iedcac3d402b89d1b0261a49647bf39cc854d1a0c Reviewed-on: https://code.wireshark.org/review/6123 Reviewed-by: Bill Meier --- epan/dissectors/packet-rtsp.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index d78f4a237a..0a33976382 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -494,7 +494,7 @@ static const char rtsp_real_tng[] = "x-pn-tng/"; /* synonym for x-real- static const char rtsp_inter[] = "interleaved="; static void -rtsp_create_conversation(packet_info *pinfo, proto_item *pi, +rtsp_create_conversation(packet_info *pinfo, proto_item *ti, const guchar *line_begin, size_t line_len, gint rdt_feature_level) { @@ -531,7 +531,7 @@ rtsp_create_conversation(packet_info *pinfo, proto_item *pi, else { /* Give up on unknown transport types */ - expert_add_info(pinfo, pi, &ei_rtsp_unknown_transport_type); + expert_add_info(pinfo, ti, &ei_rtsp_unknown_transport_type); return; } @@ -542,7 +542,7 @@ rtsp_create_conversation(packet_info *pinfo, proto_item *pi, if ((tmp = strstr(buf, rtsp_sps))) { tmp += strlen(rtsp_sps); if (sscanf(tmp, "%u-%u", &s_data_port, &s_mon_port) < 1) { - expert_add_info(pinfo, pi, &ei_rtsp_bad_server_port); + expert_add_info(pinfo, ti, &ei_rtsp_bad_server_port); return; } } @@ -550,7 +550,7 @@ rtsp_create_conversation(packet_info *pinfo, proto_item *pi, if ((tmp = strstr(buf, rtsp_cps))) { tmp += strlen(rtsp_cps); if (sscanf(tmp, "%u-%u", &c_data_port, &c_mon_port) < 1) { - expert_add_info(pinfo, pi, &ei_rtsp_bad_client_port); + expert_add_info(pinfo, ti, &ei_rtsp_bad_client_port); return; } } @@ -577,7 +577,7 @@ rtsp_create_conversation(packet_info *pinfo, proto_item *pi, i = sscanf(tmp, "%u-%u", &s_data_chan, &s_mon_chan); if (i < 1) { - expert_add_info(pinfo, pi, &ei_rtsp_bad_interleaved_channel); + expert_add_info(pinfo, ti, &ei_rtsp_bad_interleaved_channel); return; } @@ -686,7 +686,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, { proto_tree *rtsp_tree = NULL; proto_tree *sub_tree = NULL; - proto_item *ti = NULL; + proto_item *ti_top = NULL; const guchar *line; gint next_offset; const guchar *linep, *lineend; @@ -819,9 +819,9 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, orig_offset = offset; if (tree) { - ti = proto_tree_add_item(tree, proto_rtsp, tvb, offset, -1, - ENC_NA); - rtsp_tree = proto_item_add_subtree(ti, ett_rtsp); + ti_top = proto_tree_add_item(tree, proto_rtsp, tvb, offset, -1, + ENC_NA); + rtsp_tree = proto_item_add_subtree(ti_top, ett_rtsp); } /* @@ -1028,8 +1028,8 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, if (HDR_MATCHES(rtsp_transport)) { - proto_item *pi; - pi = proto_tree_add_string(rtsp_tree, hf_rtsp_transport, tvb, + proto_item *ti; + ti = proto_tree_add_string(rtsp_tree, hf_rtsp_transport, tvb, offset, linelen, tvb_format_text(tvb, value_offset, value_len)); @@ -1040,7 +1040,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, * a conversation that will be dissected * with the appropriate dissector. */ - rtsp_create_conversation(pinfo, pi, line, linelen, rdt_feature_level); + rtsp_create_conversation(pinfo, ti, line, linelen, rdt_feature_level); } else if (HDR_MATCHES(rtsp_content_type)) { proto_tree_add_string(rtsp_tree, hf_rtsp_content_type, @@ -1089,6 +1089,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, */ if (colon_offset != -1) { + proto_item *ti; /* Put the value into the protocol tree */ ti = proto_tree_add_string(rtsp_tree, hf_rtsp_X_Vig_Msisdn,tvb, offset, linelen , @@ -1221,8 +1222,8 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, * Fix up the top-level item so that it doesn't * include the SDP stuff. */ - if (ti != NULL) - proto_item_set_len(ti, offset); + if (ti_top != NULL) + proto_item_set_len(ti_top, offset); if (tvb_get_guint8(tvb, offset) == RTSP_FRAMEHDR) { /*