From 3dec62b85cf62734219cc0278c41582d5aa5bc2b Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Wed, 15 Aug 2007 22:27:52 +0000 Subject: - s/ntohs/g_ntohs - s/ntohl/g_ntohl - s/free/g_free - Change some tvb_get_string()+g_free()'s into tvb_get_ephemeral_string() - Change some tvb_fake_unicode()+g_free()'s into tvb_get_ephemeral_faked_unicode() - Change some tvb_get_string() calls that were clearly memory leaks (like atoi(tvb_get_string(...))) into tvb_get_ephemeral_string() svn path=/trunk/; revision=22515 --- epan/dissectors/packet-bittorrent.c | 49 +++++++------ epan/dissectors/packet-dcerpc.c | 15 ++-- epan/dissectors/packet-dmp.c | 9 +-- epan/dissectors/packet-dtpt.c | 18 ++--- epan/dissectors/packet-fcct.c | 30 ++++---- epan/dissectors/packet-fcdns.c | 64 ++++++++--------- epan/dissectors/packet-fcfzs.c | 78 ++++++++++----------- epan/dissectors/packet-fcswils.c | 132 ++++++++++++++++++------------------ epan/dissectors/packet-fw1.c | 2 +- epan/dissectors/packet-http.c | 4 +- epan/dissectors/packet-imf.c | 15 ++-- epan/dissectors/packet-isup.c | 8 +-- epan/dissectors/packet-msrp.c | 26 +++---- epan/dissectors/packet-mysql.c | 5 +- epan/dissectors/packet-ndps.c | 2 +- epan/dissectors/packet-p_mul.c | 7 +- epan/dissectors/packet-pppoe.c | 10 +-- epan/dissectors/packet-sdp.c | 70 +++++++++---------- 18 files changed, 263 insertions(+), 281 deletions(-) diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index f2ae482b58..71215f3dd5 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -61,11 +61,11 @@ #define BITTORRENT_HEADER_LENGTH 4 -/* +/* * Azureus messages are specified by name so these are made up numbers * for internal identification only. * - * Standard BT message types are a single byte, so these won't clash + * Standard BT message types are a single byte, so these won't clash */ #define AZUREUS_MESSAGE_HANDSHAKE 256 #define AZUREUS_MESSAGE_KEEP_ALIVE 257 @@ -278,7 +278,7 @@ static int dissect_bencoding_str(tvbuff_t *tvb, packet_info *pinfo _U_, } if (treeadd==2) { proto_item_append_text(ti, " Value: %s", format_text(ep_tvb_memdup(tvb, offset+used, stringlen), stringlen)); - } + } } return used+stringlen; } @@ -338,7 +338,7 @@ static int dissect_bencoding_int(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_int(tree, hf_bittorrent_bint, tvb, offset, used, ival); if (treeadd==2) { proto_item_append_text(ti, " Value: %d", ival); - } + } } return used; @@ -433,7 +433,7 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo _U_, } return op2len; } - + if (dtree) { ti = proto_tree_add_item(dtree, hf_bittorrent_bdict_entry, tvb, offset+used, op1len+op2len, FALSE); itree = proto_item_add_subtree(ti, ett_bittorrent_bdict_entry); @@ -441,7 +441,7 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo _U_, dissect_bencoding_str(tvb, pinfo, offset+used, length, itree, ti, 1); dissect_bencoding_rec(tvb, pinfo, offset+used+op1len, length-op1len, itree, level+1, ti, 2); } - + used += op1len+op2len; length -= op1len+op2len; } @@ -465,7 +465,7 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo _U_, if (op=='e') { return used+1; } - + oplen = dissect_bencoding_rec(tvb, pinfo, offset+used, length, itree, level+1, ti, 0); if (oplen<1) return oplen; @@ -502,7 +502,7 @@ static void dissect_bencoding(tvbuff_t *tvb, packet_info *pinfo _U_, { dissect_bencoding_rec(tvb, pinfo, offset, length, tree, 0, NULL, 0); } - + static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; @@ -525,7 +525,7 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto type = tvb_get_guint8(tvb, offset + BITTORRENT_HEADER_LENGTH); if (type==BITTORRENT_MESSAGE_CHOKE && length>4) { - /* + /* * Choke messages have no payload, so this is likely an Azureus * Messaging Protocol packet */ @@ -559,7 +559,7 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto msgtype = match_strval(type, azureus_messages); } */ if (msgtype == NULL) { - proto_tree_add_text(tree, tvb, offset, -1, "Continuation data"); + proto_tree_add_text(tree, tvb, offset, -1, "Continuation data"); if (check_col(pinfo->cinfo, COL_INFO)) { col_set_str(pinfo->cinfo, COL_INFO, "Continuation data"); } @@ -640,7 +640,7 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto break; case BITTORRENT_MESSAGE_BITFIELD: - proto_tree_add_item(mtree, hf_bittorrent_bitfield_data, tvb, offset, length, FALSE); + proto_tree_add_item(mtree, hf_bittorrent_bitfield_data, tvb, offset, length, FALSE); proto_item_append_text(ti, ", Len:0x%x", length); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Len:0x%x", length); @@ -690,15 +690,15 @@ static void dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, p int offset = 0; int i; char *version; - + if (check_col(pinfo->cinfo, COL_INFO)) { col_set_str(pinfo->cinfo, COL_INFO, "Handshake"); } - + proto_tree_add_item(tree, hf_bittorrent_prot_name_len, tvb, offset, 1, FALSE); offset+=1; proto_tree_add_item(tree, hf_bittorrent_prot_name, tvb, offset, 19, FALSE); offset += 19; proto_tree_add_item(tree, hf_bittorrent_reserved, tvb, offset, 8, FALSE); offset += 8; - + proto_tree_add_item(tree, hf_bittorrent_sha1_hash, tvb, offset, 20, FALSE); offset += 20; @@ -710,12 +710,11 @@ static void dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, p /* The version number is 4 numeric characters for the client ids beginning with '-' and 3 characters for the rest. */ - version = tvb_get_string(tvb, offset + strlen(peer_id[i].id), + version = tvb_get_ephemeral_string(tvb, offset + strlen(peer_id[i].id), (peer_id[i].id[0] == '-') ? 4 : 3); proto_tree_add_text(tree, tvb, offset, 20, "Client is %s v%s", peer_id[i].name, format_text((guchar*)version, (peer_id[i].id[0] == '-') ? 4 : 3)); - g_free(version); break; } } @@ -726,18 +725,18 @@ static void dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, p static void dissect_bittorrent_tcp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; - + if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "BitTorrent"); } - + if (check_col(pinfo->cinfo, COL_INFO)) { col_set_str(pinfo->cinfo, COL_INFO, "BitTorrent "); } - - ti = proto_tree_add_item (tree, proto_bittorrent, tvb, 0, -1, FALSE); + + ti = proto_tree_add_item (tree, proto_bittorrent, tvb, 0, -1, FALSE); tree = proto_item_add_subtree(ti, ett_bittorrent); - + if (tvb_get_guint8(tvb, 0) == 19 && tvb_memeql(tvb, 1, "BitTorrent protocol", 19) == 0) { dissect_bittorrent_welcome(tvb, pinfo, tree); @@ -781,7 +780,7 @@ void proto_register_bittorrent(void) { static hf_register_info hf[] = { - { &hf_bittorrent_field_length, + { &hf_bittorrent_field_length, { "Field Length", "bittorrent.length", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } }, { &hf_bittorrent_prot_name_len, @@ -799,12 +798,12 @@ proto_register_bittorrent(void) { &hf_bittorrent_peer_id, { "Peer ID", "bittorrent.peer_id", FT_BYTES, BASE_DEC, NULL, 0x0, "", HFILL } }, - { &hf_bittorrent_msg, + { &hf_bittorrent_msg, { "Message", "bittorrent.msg", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL } }, { &hf_bittorrent_msg_len, { "Message Length", "bittorrent.msg.length", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, + }, { &hf_bittorrent_msg_type, { "Message Type", "bittorrent.msg.type", FT_UINT8, BASE_DEC, VALS(bittorrent_messages), 0x0, "", HFILL } }, @@ -829,7 +828,7 @@ proto_register_bittorrent(void) { &hf_bittorrent_piece_begin, { "Begin offset of piece", "bittorrent.piece.begin", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL } }, - { &hf_bittorrent_piece_data, + { &hf_bittorrent_piece_data, { "Data in a piece", "bittorrent.piece.data", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } }, { &hf_bittorrent_piece_length, diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 9c0eabf00f..3e2c521cfb 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -1380,7 +1380,7 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, } } else { /* - * "tvb_get_string()" throws an exception if the entire string + * "tvb_get_ephemeral_string()" throws an exception if the entire string * isn't in the tvbuff. If the length is bogus, this should * keep us from trying to allocate an immensely large buffer. * (It won't help if the length is *valid* but immensely large, @@ -1388,7 +1388,7 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, * if we had an immensely large tvbuff....) */ tvb_ensure_bytes_exist(tvb, offset, buffer_len); - s = tvb_get_string(tvb, offset, buffer_len); + s = tvb_get_ephemeral_string(tvb, offset, buffer_len); if (tree && buffer_len) proto_tree_add_item(string_tree, hfindex, tvb, offset, buffer_len, drep[0] & 0x10); @@ -1399,8 +1399,6 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, if (data) *data = s; - else - g_free(s); offset += buffer_len; @@ -1454,7 +1452,7 @@ dissect_ndr_wchar_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, /* This function is aimed for PIDL useage and dissects a UNIQUE pointer to * unicode string. */ -int +int PIDL_dissect_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int chsize, int hfindex, guint32 param) { dcerpc_info *di; @@ -1567,7 +1565,7 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, } } else { /* - * "tvb_get_string()" throws an exception if the entire string + * "tvb_get_ephemeral_string()" throws an exception if the entire string * isn't in the tvbuff. If the length is bogus, this should * keep us from trying to allocate an immensely large buffer. * (It won't help if the length is *valid* but immensely large, @@ -1575,7 +1573,7 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, * if we had an immensely large tvbuff....) */ tvb_ensure_bytes_exist(tvb, offset, buffer_len); - s = tvb_get_string(tvb, offset, buffer_len); + s = tvb_get_ephemeral_string(tvb, offset, buffer_len); if (tree && buffer_len) proto_tree_add_item(string_tree, hfindex, tvb, offset, buffer_len, drep[0] & 0x10); @@ -1586,8 +1584,6 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, if (data) *data = s; - else - g_free(s); offset += buffer_len; @@ -1595,6 +1591,7 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, return offset; } + /* Dissect an varying string of chars. This corresponds to IDL of the form '[string] char *foo'. diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index e3e3cc02d0..a46c8075c1 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -2120,17 +2120,15 @@ static void dissect_dmp_structured_id (tvbuff_t *tvb, proto_tree *body_tree, break; case STRUCT_ID_STRING: - id_string = tvb_get_string (tvb, offset, (gint) dmp_struct_length); + id_string = tvb_get_ephemeral_string (tvb, offset, (gint) dmp_struct_length); g_snprintf (dmp.struct_id, MAX_STRUCT_ID_LEN, "%s", id_string); - g_free (id_string); tf = proto_tree_add_item (body_tree, hf_message_bodyid_string, tvb, offset, dmp_struct_length, FALSE); break; case STRUCT_ID_ZSTRING: - id_string = tvb_get_stringz (tvb, offset, &length); + id_string = tvb_get_ephemeral_stringz (tvb, offset, &length); g_snprintf (dmp.struct_id, MAX_STRUCT_ID_LEN, "%s", id_string); - g_free (id_string); tf = proto_tree_add_item (body_tree, hf_message_bodyid_zstring, tvb, offset, length, FALSE); break; @@ -2158,9 +2156,8 @@ static gint dissect_dmp_message (tvbuff_t *tvb, packet_info *pinfo _U_, if (dmp.body_format == FREE_TEXT_SUBJECT) { len = tvb_strsize (tvb, offset); if (dmp_subject_as_id) { - subject = tvb_get_string (tvb, offset, len); + subject = tvb_get_ephemeral_string (tvb, offset, len); g_snprintf (dmp.struct_id, MAX_STRUCT_ID_LEN, "%s", subject); - g_free (subject); } proto_tree_add_item (message_tree, hf_message_subject, tvb, offset, len, FALSE); diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c index a42501e42a..8e380f61f5 100644 --- a/epan/dissectors/packet-dtpt.c +++ b/epan/dissectors/packet-dtpt.c @@ -236,7 +236,7 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) guint32 wstring_padding = 0; wstring_length = tvb_get_letohl(tvb, offset); - wstring_data = tvb_fake_unicode(tvb, offset+4, wstring_length, 1); + wstring_data = tvb_get_ephemeral_faked_unicode(tvb, offset+4, wstring_length, 1); wstring_size = wstring_length; if (wstring_size%4) { wstring_padding = (4-wstring_size%4); @@ -256,14 +256,10 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) proto_tree_add_string(dtpt_wstring_tree, hf_dtpt_wstring_data, tvb, offset+4, wstring_length, wstring_data); if (wstring_padding) - proto_tree_add_text(dtpt_wstring_tree, tvb, + proto_tree_add_text(dtpt_wstring_tree, tvb, offset+4+wstring_length,wstring_padding, "Padding"); } } - if (wstring_data != NULL) { - free(wstring_data); - wstring_data = NULL; - } offset += 4+wstring_size; return offset; } @@ -412,7 +408,7 @@ dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex return offset; } -static int +static int dissect_dtpt_conversation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint offset = 0; @@ -593,7 +589,7 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 offset2; offset2 = offset + 24*num_addrs; - + for (i=0;i * Copyright 1998 Gerald Combs - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -159,22 +159,22 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fc_ct_preamble cthdr; /* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC_CT"); - + /* cthdr.revision = tvb_get_guint8 (tvb, offset++); cthdr.in_id = tvb_get_ntoh24 (tvb, offset); offset += 3; - + cthdr.gstype = tvb_get_guint8 (tvb, offset++); cthdr.options = tvb_get_guint8 (tvb, offset++); */ tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE); cthdr.revision = tvb_get_guint8 (tvb, offset++); cthdr.in_id = tvb_get_ntoh24 (tvb, offset); - cthdr.opcode = ntohs (cthdr.opcode); - cthdr.maxres_size = ntohs (cthdr.maxres_size); + cthdr.opcode = g_ntohs (cthdr.opcode); + cthdr.maxres_size = g_ntohs (cthdr.maxres_size); if (check_col (pinfo->cinfo, COL_INFO)) { if (cthdr.opcode < FCCT_MSG_REQ_MAX) { @@ -185,19 +185,19 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if (cthdr.opcode == FCCT_MSG_RJT) { col_append_fstr (pinfo->cinfo, COL_INFO, " Reject (%s)", - val_to_str (cthdr.rjt_code, fc_ct_rjt_code_vals, "0x%x")); + val_to_str (cthdr.rjt_code, fc_ct_rjt_code_vals, "0x%x")); } else { col_append_str (pinfo->cinfo, COL_INFO, " Reserved"); } } - + in_id = cthdr.in_id; - in_id = htonl (in_id) >> 8; + in_id = g_htonl (in_id) >> 8; /* Determine server */ server = get_gs_server (cthdr.gstype, cthdr.gssubtype); - + if (tree) { offset = 0; ti = proto_tree_add_protocol_format (tree, proto_fcct, tvb, 0, FCCT_PRMBL_SIZE, @@ -209,7 +209,7 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_string (fcct_tree, hf_fcct_inid, tvb, offset, 3, fc_to_str ((guint8 *)&in_id)); offset += 3; /* sizeof FC address */ - + proto_tree_add_item (fcct_tree, hf_fcct_gstype, tvb, offset++, sizeof (guint8), 0); proto_tree_add_item (fcct_tree, hf_fcct_gssubtype, tvb, offset, @@ -238,12 +238,12 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_fcct(void) -{ +{ /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &hf_fcct_revision, - {"Revision", "fcct.revision", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}}, + {"Revision", "fcct.revision", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL}}, { &hf_fcct_inid, {"IN_ID", "fcct.in_id", FT_STRING, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcct_gstype, diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index c7e357804e..28d416dafe 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -13,17 +13,17 @@ * don't bother with the "Copied from" - you don't even need to put * in a "Copied from" if you copied an existing dissector, especially * if the bulk of the code in the new dissector is your code) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -215,7 +215,7 @@ dissect_cos_flags (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfind flags = tvb_get_ntohl (tvb, offset); if(parent_tree){ - item=proto_tree_add_uint(parent_tree, hfindex, + item=proto_tree_add_uint(parent_tree, hfindex, tvb, offset, 1, flags); tree=proto_item_add_subtree(item, ett_cos_flags); } @@ -268,7 +268,7 @@ static const true_false_string tfs_fcdns_fc4features_t = { "t is NOT set" }; -/* The feature routines just decode FCP's FC-4 features field +/* The feature routines just decode FCP's FC-4 features field * based on the flahs in offset and the type in offset+1 */ static void @@ -281,7 +281,7 @@ dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset flags = tvb_get_guint8(tvb, offset); type = tvb_get_guint8(tvb, offset+1); if(parent_tree){ - item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features, + item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features, tvb, offset, 1, flags); tree=proto_item_add_subtree(item, ett_fc4features); } @@ -303,7 +303,7 @@ dissect_fc4features_and_type (proto_tree *parent_tree, tvbuff_t *tvb, int offset proto_tree_add_item (tree, hf_fcdns_req_fc4type, tvb, offset+1, 1, 0); } -/* The feature routines just decode FCP's FC-4 features field +/* The feature routines just decode FCP's FC-4 features field */ static void dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset) @@ -314,7 +314,7 @@ dissect_fc4features (proto_tree *parent_tree, tvbuff_t *tvb, int offset) flags = tvb_get_guint8(tvb, offset); if(parent_tree){ - item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features, + item=proto_tree_add_uint(parent_tree, hf_fcdns_fc4features, tvb, offset, 1, flags); tree=proto_item_add_subtree(item, ett_fc4features); } @@ -398,7 +398,7 @@ dissect_fc4type (proto_tree *parent_tree, tvbuff_t *tvb, int offset, int hfindex flags = tvb_get_ntohl (tvb, offset+4); - + proto_tree_add_boolean(tree, hf_fcdns_fc4type_swils, tvb, offset+4, 4, flags); if (flags&0x0010){ proto_item_append_text(item, " SW_ILS"); @@ -465,7 +465,7 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) offset+12, 1, 0); if (!tvb_offset_exists (tvb, 29+len)) return; - + if (len) { proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb, offset+13, len, 0); @@ -598,7 +598,7 @@ dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) } else { len = tvb_get_guint8 (tvb, offset); - proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, + proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb, offset, 1, 0); proto_tree_add_string (req_tree, hf_fcdns_rply_spname, tvb, offset+1, len, @@ -1023,7 +1023,7 @@ dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) tvb, offset+1, 3, fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); - proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, + proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset+4, 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+4, 8))); @@ -1088,7 +1088,7 @@ dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb, offset+4, 1, 0); len = tvb_get_guint8 (tvb, offset+4); - + proto_tree_add_item (req_tree, hf_fcdns_req_spname, tvb, offset+5, len, 0); } @@ -1124,7 +1124,7 @@ dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) len = tvb_length (tvb) - offset - 36; offset += 36; - + while (len > 0) { dlen = tvb_get_guint8 (tvb, offset); proto_tree_add_item (req_tree, hf_fcdns_req_fdesclen, tvb, offset, @@ -1242,7 +1242,7 @@ dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb, offset+4, idlen, "Unknown member type format"); - + } } @@ -1263,7 +1263,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) objfmt = tvb_get_guint8 (tvb, offset); proto_tree_add_item (tree, hf_fcdns_sw2_objfmt, tvb, offset, 1, 0); - proto_tree_add_string (tree, hf_fcdns_rply_ownerid, tvb, offset+1, + proto_tree_add_string (tree, hf_fcdns_rply_ownerid, tvb, offset+1, 3, fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4, @@ -1325,7 +1325,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) proto_tree_add_item (tree, hf_fcdns_num_fc4desc, tvb, offset+129, 1, 0); } - offset += 388; /* FC4 desc is 260 bytes, maybe padded */ + offset += 388; /* FC4 desc is 260 bytes, maybe padded */ } } } @@ -1521,9 +1521,9 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE); cthdr.revision = tvb_get_guint8 (tvb, offset); cthdr.in_id = tvb_get_ntoh24 (tvb, offset+1); - cthdr.opcode = ntohs (cthdr.opcode); + cthdr.opcode = g_ntohs (cthdr.opcode); opcode = cthdr.opcode; - cthdr.maxres_size = ntohs (cthdr.maxres_size); + cthdr.maxres_size = g_ntohs (cthdr.maxres_size); /* Determine the type of server the request/response is for */ if (check_col(pinfo->cinfo, COL_PROTOCOL)) { @@ -1557,25 +1557,25 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->ptype, pinfo->oxid, pinfo->rxid, NO_PORT2); } - + ckey.conv_idx = conversation->index; - + cdata = (fcdns_conv_data_t *)g_hash_table_lookup (fcdns_req_hash, &ckey); if (cdata) { /* Since we never free the memory used by an exchange, this maybe a * case of another request using the same exchange as a previous - * req. + * req. */ cdata->opcode = opcode; } else { req_key = se_alloc (sizeof(fcdns_conv_key_t)); req_key->conv_idx = conversation->index; - + cdata = se_alloc (sizeof(fcdns_conv_data_t)); cdata->opcode = opcode; - + g_hash_table_insert (fcdns_req_hash, req_key, cdata); } if (check_col (pinfo->cinfo, COL_INFO)) { @@ -1614,7 +1614,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else failed_opcode = cdata->opcode; } - + if (check_col (pinfo->cinfo, COL_INFO)) { if (opcode != FCCT_MSG_RJT) { col_add_fstr (pinfo->cinfo, COL_INFO, "ACC (%s)", @@ -1628,7 +1628,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "0x%x")); } } - + if (tree) { if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { /* No record of what this accept is for. Can't decode */ @@ -1645,7 +1645,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item (fcdns_tree, hf_fcdns_maxres_size, tvb, offset+10, 2, 0); } - + switch (opcode) { case FCCT_MSG_RJT: dissect_fcdns_rjt (tvb, fcdns_tree); @@ -1795,7 +1795,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_fcdns (void) -{ +{ /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { @@ -1932,7 +1932,7 @@ proto_register_fcdns (void) {"Class of Service Supported", "fcdns.reply.cos", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcdns_req_cos, - {"Requested Class of Service", "fcdns.req.class", FT_UINT32, BASE_HEX, + {"Requested Class of Service", "fcdns.req.class", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcdns_cos_f, {"F", "fcdns.cos.f", FT_BOOLEAN, 32, @@ -1977,10 +1977,10 @@ proto_register_fcdns (void) {"FC-4 Types Supported", "fcdns.rply.fc4type", FT_NONE, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcdns_req_fc4types, - {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE, BASE_HEX, + {"FC-4 Types Supported", "fcdns.req.fc4types", FT_NONE, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcdns_fc4type, - {"FC-4 Types", "fcdns.req.fc4type", FT_NONE, BASE_HEX, + {"FC-4 Types", "fcdns.req.fc4type", FT_NONE, BASE_HEX, NULL, 0x0, "", HFILL}}, { &hf_fcdns_fc4features, {"FC-4 Feature Bits", "fcdns.fc4features", FT_UINT8, @@ -1999,7 +1999,7 @@ proto_register_fcdns (void) &ett_fc4flags, &ett_fc4features, }; - + /* Register the protocol name and description */ proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns"); diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c index 95dac45b01..011a3d5469 100644 --- a/epan/dissectors/packet-fcfzs.c +++ b/epan/dissectors/packet-fcfzs.c @@ -13,17 +13,17 @@ * don't bother with the "Copied from" - you don't even need to put * in a "Copied from" if you copied an existing dissector, especially * if the bulk of the code in the new dissector is your code) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -143,7 +143,7 @@ static void dissect_fcfzs_zoneset (tvbuff_t *tvb, proto_tree *tree, int offset) { int numzones, nummbrs, i, j, len; - + /* The zoneset structure has the following format */ /* zoneset name (len[not including pad], name, pad), * number of zones, @@ -154,7 +154,7 @@ dissect_fcfzs_zoneset (tvbuff_t *tvb, proto_tree *tree, int offset) */ if (tree) { - /* Zoneset Name */ + /* Zoneset Name */ len = tvb_get_guint8 (tvb, offset); proto_tree_add_item (tree, hf_fcfzs_zonesetnmlen, tvb, offset, 1, 0); @@ -162,13 +162,13 @@ dissect_fcfzs_zoneset (tvbuff_t *tvb, proto_tree *tree, int offset) len, 0); offset += 4 + len + (4-(len % 4)); - - /* Number of zones */ + + /* Number of zones */ numzones = tvb_get_ntohl (tvb, offset); proto_tree_add_item (tree, hf_fcfzs_numzones, tvb, offset, 4, 0); offset += 4; - - /* For each zone... */ + + /* For each zone... */ for (i = 0; i < numzones; i++) { len = tvb_get_guint8 (tvb, offset); proto_tree_add_item (tree, hf_fcfzs_zonenmlen, tvb, offset, @@ -184,7 +184,7 @@ dissect_fcfzs_zoneset (tvbuff_t *tvb, proto_tree *tree, int offset) offset += 4; for (j = 0; j < nummbrs; j++) { proto_tree_add_item (tree, hf_fcfzs_mbrtype, tvb, offset, 1, 0); - + switch (tvb_get_guint8 (tvb, offset)) { case FC_FZS_ZONEMBR_PWWN: case FC_FZS_ZONEMBR_NWWN: @@ -268,7 +268,7 @@ dissect_fcfzs_gzc (tvbuff_t *tvb, int offset, proto_tree *parent_tree, guint8 is guint8 flags; proto_item *item=NULL; proto_tree *tree=NULL; - + flags = tvb_get_guint8 (tvb, offset); if(parent_tree){ item=proto_tree_add_uint(parent_tree, hf_fcfzs_gzc_flags, tvb, offset, 1, flags); @@ -315,7 +315,7 @@ dissect_fcfzs_gest (tvbuff_t *tvb, proto_tree *parent_tree, guint8 isreq) guint8 flags; proto_item *item=NULL; proto_tree *tree=NULL; - + flags = tvb_get_guint8 (tvb, offset); if(parent_tree){ item=proto_tree_add_uint(parent_tree, hf_fcfzs_zone_state, tvb, offset, 1, flags); @@ -344,7 +344,7 @@ dissect_fcfzs_gzsn (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int numrec, i, len; int offset = 16; /* past the fc_ct header */ - + if (tree) { if (!isreq) { numrec = tvb_get_ntohl (tvb, offset); @@ -373,7 +373,7 @@ dissect_fcfzs_gzd (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int numrec, i, len; int offset = 16; /* past the fc_ct header */ - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -387,7 +387,7 @@ dissect_fcfzs_gzd (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) proto_tree_add_item (tree, hf_fcfzs_numzoneattrs, tvb, offset, 4, 0); - + offset += 4; for (i = 0; i < numrec; i++) { len = tvb_get_guint8 (tvb, offset); @@ -409,7 +409,7 @@ dissect_fcfzs_gzm (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int numrec, i, len; int offset = 16; /* past the fc_ct header */ - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -465,7 +465,7 @@ static void dissect_fcfzs_gazs (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ - + if (tree) { if (!isreq) { dissect_fcfzs_zoneset (tvb, tree, offset); @@ -478,7 +478,7 @@ dissect_fcfzs_gzs (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ int len; - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -497,7 +497,7 @@ static void dissect_fcfzs_adzs (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ - + if (tree) { if (isreq) { dissect_fcfzs_zoneset (tvb, tree, offset); @@ -509,7 +509,7 @@ static void dissect_fcfzs_azsd (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ - + if (tree) { if (isreq) { dissect_fcfzs_zoneset (tvb, tree, offset); @@ -522,7 +522,7 @@ dissect_fcfzs_arzs (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ int len; - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -546,7 +546,7 @@ dissect_fcfzs_arzm (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int numrec, i, len, plen; int offset = 16; /* past the fc_ct header */ - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -603,7 +603,7 @@ dissect_fcfzs_arzd (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 16; /* past the fc_ct header */ int len; - + if (tree) { if (isreq) { len = tvb_get_guint8 (tvb, offset); @@ -613,7 +613,7 @@ dissect_fcfzs_arzd (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) len, 0); len += (len % 4); offset += len; - + len = tvb_get_guint8 (tvb, offset); proto_tree_add_item (tree, hf_fcfzs_zonenmlen, tvb, offset, 1, 0); proto_tree_add_item (tree, hf_fcfzs_zonename, tvb, offset+4, @@ -630,7 +630,7 @@ dissect_fcfzs_rjt (tvbuff_t *tvb, proto_tree *tree) if (tree) { proto_tree_add_item (tree, hf_fcfzs_reason, tvb, offset+13, 1, 0); proto_tree_add_item (tree, hf_fcfzs_rjtdetail, tvb, offset+14, 1, 0); - proto_tree_add_item (tree, hf_fcfzs_rjtvendor, tvb, offset+15, 1, 0); + proto_tree_add_item (tree, hf_fcfzs_rjtvendor, tvb, offset+15, 1, 0); } } @@ -651,16 +651,16 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 isreq = 1; /* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Zone Server"); - - + + tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE); cthdr.revision = tvb_get_guint8 (tvb, offset+1); cthdr.in_id = tvb_get_ntoh24 (tvb, offset); - cthdr.opcode = ntohs (cthdr.opcode); + cthdr.opcode = g_ntohs (cthdr.opcode); opcode = cthdr.opcode; - cthdr.maxres_size = ntohs (cthdr.maxres_size); + cthdr.maxres_size = g_ntohs (cthdr.maxres_size); if (tree) { ti = proto_tree_add_protocol_format (tree, proto_fcfzs, tvb, 0, @@ -671,7 +671,7 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item (fcfzs_tree, hf_fcfzs_maxres_size, tvb, offset+10, 2, 0); } - + if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) { conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->oxid, @@ -681,25 +681,25 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->ptype, pinfo->oxid, pinfo->rxid, NO_PORT2); } - + ckey.conv_idx = conversation->index; - + cdata = (fcfzs_conv_data_t *)g_hash_table_lookup (fcfzs_req_hash, &ckey); if (cdata) { /* Since we never free the memory used by an exchange, this maybe a * case of another request using the same exchange as a previous - * req. + * req. */ cdata->opcode = opcode; } else { req_key = se_alloc (sizeof(fcfzs_conv_key_t)); req_key->conv_idx = conversation->index; - + cdata = se_alloc (sizeof(fcfzs_conv_data_t)); cdata->opcode = opcode; - + g_hash_table_insert (fcfzs_req_hash, req_key, cdata); } if (check_col (pinfo->cinfo, COL_INFO)) { @@ -737,7 +737,7 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else failed_opcode = cdata->opcode; } - + if (check_col (pinfo->cinfo, COL_INFO)) { if (opcode != FCCT_MSG_RJT) { col_add_fstr (pinfo->cinfo, COL_INFO, "MSG_ACC (%s)", @@ -750,7 +750,7 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fc_fzs_opcode_val, "0x%x")); } } - + if (tree) { if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { /* No record of what this accept is for. Can't decode */ @@ -828,7 +828,7 @@ dissect_fcfzs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_fcfzs(void) -{ +{ /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index 892e2d21ac..42715976dd 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -7,17 +7,17 @@ * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -530,9 +530,9 @@ get_zoneobj_len (tvbuff_t *tvb, gint offset) static int dissect_swils_interconnect_element_info (tvbuff_t *tvb, proto_tree *tree, int offset) { - + int len, max_len = MAX_INTERCONNECT_ELEMENT_INFO_LEN; - + if (tree) { proto_tree_add_item (tree, hf_swils_interconnect_list_len, tvb, offset+3, 1, 0); len = tvb_strsize (tvb, offset+4); @@ -619,7 +619,7 @@ dissect_swils_ess_capability (tvbuff_t *tvb, proto_tree *tree, int offset, break; } } - + return; } @@ -656,12 +656,12 @@ dissect_swils_ess_capability_obj (tvbuff_t *tvb, proto_tree *tree, int offset) type); capinfo_tree = proto_item_add_subtree (ti, ett_fcswils_capinfo); } - + proto_tree_add_item (capinfo_tree, hf_swils_ess_cap_type, tvb, offset, 1, 0); proto_tree_add_item (capinfo_tree, hf_swils_ess_cap_subtype, tvb, offset+1, 1, 0); subtype = tvb_get_guint8 (tvb, offset+1); - + if (type != FCCT_GSTYPE_VENDOR) { srvr_type = get_gs_server (type, subtype); proto_tree_add_uint (capinfo_tree, hf_swils_ess_cap_svc, tvb, offset, 2, @@ -670,7 +670,7 @@ dissect_swils_ess_capability_obj (tvbuff_t *tvb, proto_tree *tree, int offset) offset+3, 1, 0); offset += 4; len += 4; - + while ((num_entries > 0) && tvb_bytes_exist (tvb, offset, 8)) { dissect_swils_ess_capability (tvb, capinfo_tree, offset, srvr_type); num_entries--; @@ -712,7 +712,7 @@ dissect_swils_nullpayload (tvbuff_t *tvb _U_, proto_tree *tree _U_, static void dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) { - + /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; const gchar *flags; @@ -721,12 +721,12 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) /* Response i.e. SW_ACC for an ELP has the same format as the request */ /* We skip the initial 4 bytes as we don't care about the opcode */ tvb_memcpy (tvb, (guint8 *)&elp, 4, FC_SWILS_ELP_SIZE); - + elp.r_a_tov = g_ntohl (elp.r_a_tov); elp.e_d_tov = g_ntohl (elp.e_d_tov); - elp.isl_flwctrl_mode = ntohs (elp.isl_flwctrl_mode); - elp.flw_ctrl_parmlen = ntohs (elp.flw_ctrl_parmlen); - + elp.isl_flwctrl_mode = g_ntohs (elp.isl_flwctrl_mode); + elp.flw_ctrl_parmlen = g_ntohs (elp.flw_ctrl_parmlen); + if (elp_tree) { offset += 4; proto_tree_add_item (elp_tree, hf_swils_elp_rev, tvb, offset++, 1, 0); @@ -755,7 +755,7 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) } else { flags="Class F Invld"; } - proto_tree_add_bytes_format (elp_tree, hf_swils_elp_clsf_svcp, tvb, offset, 6, + proto_tree_add_bytes_format (elp_tree, hf_swils_elp_clsf_svcp, tvb, offset, 6, &elp.clsf_svcparm[0], "Class F Svc Parameters: (%s)", flags); offset += 6; @@ -798,7 +798,7 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) else { flags="Class 1 Invalid"; } - + proto_tree_add_bytes_format (elp_tree, hf_swils_elp_cls1_svcp, tvb, offset, 2, tvb_get_ptr (tvb, offset, 2), "Class 1 Svc Parameters: (%s)", flags); @@ -820,17 +820,17 @@ dissect_swils_elp (tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) else { flags="Class 2 Invld"; } - + proto_tree_add_bytes_format (elp_tree, hf_swils_elp_cls2_svcp, tvb, offset, 2, &elp.cls2_svcparm[0], "Class 2 Svc Parameters: (%s)", flags); offset += 2; - + if (elp.cls2_svcparm[0] & 0x80) { proto_tree_add_item (elp_tree, hf_swils_elp_cls2_rcvsz, tvb, offset, 2, 0); } offset += 2; - + flags=""; if (elp.cls3_svcparm[0] & 0x80) { if (elp.cls3_svcparm[0] & 0x08) { @@ -882,7 +882,7 @@ dissect_swils_efp (tvbuff_t *tvb, proto_tree *efp_tree, guint8 isreq _U_) offset = 0; fcswils_efp efp; guint8 rec_type; - + offset += 1; efp.reclen = tvb_get_guint8 (tvb, offset); if (efp_tree) @@ -926,11 +926,11 @@ dissect_swils_efp (tvbuff_t *tvb, proto_tree *efp_tree, guint8 isreq _U_) "Unknown record type (0x%02x)")); lrec_tree = proto_item_add_subtree (subti, ett_fcswils_efplist); proto_tree_add_uint (lrec_tree, hf_swils_efp_rec_type, tvb, offset, 1, - rec_type); + rec_type); switch (rec_type) { case FC_SWILS_LRECTYPE_DOMAIN: - proto_tree_add_item (lrec_tree, hf_swils_efp_dom_id, tvb, offset+1, 1, 0); + proto_tree_add_item (lrec_tree, hf_swils_efp_dom_id, tvb, offset+1, 1, 0); proto_tree_add_string (lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8, fcwwn_to_str (tvb_get_ptr(tvb, offset+8, 8))); break; @@ -962,10 +962,10 @@ dissect_swils_rdi (tvbuff_t *tvb, proto_tree *rdi_tree, guint8 isreq) /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; int i, plen, numrec; - + if (rdi_tree) { plen = tvb_get_ntohs (tvb, offset+2); - + proto_tree_add_item (rdi_tree, hf_swils_rdi_payload_len, tvb, offset+2, 2, 0); proto_tree_add_string (rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4, 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+4, 8))); @@ -996,7 +996,7 @@ dissect_swils_fspf_hdr (tvbuff_t *tvb, proto_tree *tree, int offset) { proto_item *subti; proto_tree *fspfh_tree; - + if (tree) { /* 20 is the size of FSPF header */ subti = proto_tree_add_text (tree, tvb, offset, 20, "FSPF Header"); @@ -1053,22 +1053,22 @@ dissect_swils_fspf_lsrec (tvbuff_t *tvb, proto_tree *tree, int offset, if (tree) { for (j = 0; j < num_lsrec; j++) { - num_ldrec = tvb_get_ntohs (tvb, offset+26); + num_ldrec = tvb_get_ntohs (tvb, offset+26); subti = proto_tree_add_text (tree, tvb, offset, (28+num_ldrec*16), "Link State Record %d (Domain %d)", j, tvb_get_guint8 (tvb, offset+15)); lsrec_tree = proto_item_add_subtree (subti, ett_fcswils_lsrec); - + subti = proto_tree_add_text (lsrec_tree, tvb, offset, 24, "Link State Record Header"); lsrechdr_tree = proto_item_add_subtree (subti, - ett_fcswils_lsrechdr); - + ett_fcswils_lsrechdr); + dissect_swils_fspf_lsrechdr (tvb, lsrechdr_tree, offset); proto_tree_add_text (tree, tvb, offset+26, 2, "Number of Links: %d", num_ldrec); offset += 28; - + for (i = 0; i < num_ldrec; i++) { subti1 = proto_tree_add_text (lsrec_tree, tvb, offset, 16, "Link Descriptor %d " @@ -1149,7 +1149,7 @@ dissect_swils_lsack (tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_) "Link State Record Header (Domain %d)", tvb_get_guint8 (tvb, offset+15)); lsrechdr_tree = proto_item_add_subtree (subti, - ett_fcswils_lsrechdr); + ett_fcswils_lsrechdr); dissect_swils_fspf_lsrechdr (tvb, lsrechdr_tree, offset); offset += 24; } @@ -1165,11 +1165,11 @@ dissect_swils_rscn (tvbuff_t *tvb, proto_tree *rscn_tree, guint8 isreq) int addrfmt, evtype; int numrec, i; proto_item *subti; - + if (rscn_tree) { if (!isreq) return; - + evtype = tvb_get_guint8 (tvb, offset+4); addrfmt = evtype & 0x0F; evtype = evtype >> 4; @@ -1184,12 +1184,12 @@ dissect_swils_rscn (tvbuff_t *tvb, proto_tree *rscn_tree, guint8 isreq) proto_tree_add_item (rscn_tree, hf_swils_rscn_detectfn, tvb, offset+8, 4, 0); numrec = tvb_get_ntohl (tvb, offset+12); - + if (!tvb_bytes_exist (tvb, offset+16, FC_SWILS_RSCN_DEVENTRY_SIZE*numrec)) { /* Some older devices do not include device entry information. */ return; } - + proto_tree_add_text (rscn_tree, tvb, offset+12, 4, "Num Entries: %d", numrec); @@ -1295,7 +1295,7 @@ dissect_swils_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) proto_tree_add_string (zmbr_tree, hf_swils_zone_mbrid, tvb, offset+4, idlen, "Unknown member type format"); - + } } @@ -1308,7 +1308,7 @@ dissect_swils_zone_obj (tvbuff_t *tvb, proto_tree *zobj_tree, int offset) proto_item *subti; objtype = tvb_get_guint8 (tvb, offset); - + proto_tree_add_item (zobj_tree, hf_swils_zone_objtype, tvb, offset, 1, 0); proto_tree_add_item (zobj_tree, hf_swils_zone_protocol, tvb, @@ -1352,7 +1352,7 @@ dissect_swils_mergereq (tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) if (mr_tree) { if (isreq) { - /* zonesetlen is the size of the zoneset including the zone name */ + /* zonesetlen is the size of the zoneset including the zone name */ zonesetlen = tvb_get_ntohs (tvb, offset+2); proto_tree_add_text (mr_tree, tvb, offset+2, 2, "Active ZoneSet Length: %u", zonesetlen); @@ -1362,18 +1362,18 @@ dissect_swils_mergereq (tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) proto_tree_add_string (mr_tree, hf_swils_zone_activezonenm, tvb, offset+4, ZONENAME_LEN (tvb, offset+4), str); - - /* objlistlen gives the size of the active zoneset object list */ + + /* objlistlen gives the size of the active zoneset object list */ objlistlen = zonesetlen - ZONENAME_LEN (tvb, offset+4); /* Offset = start of the active zoneset zoning object list */ offset = offset + (4 + ZONENAME_LEN (tvb, offset+4)); numrec = tvb_get_ntohl (tvb, offset); - + subti = proto_tree_add_text (mr_tree, tvb, offset, objlistlen, "Active Zone Set"); zobjlist_tree = proto_item_add_subtree (subti, ett_fcswils_zoneobjlist); - + proto_tree_add_text (zobjlist_tree, tvb, offset, 4, "Number of zoning objects: %d", numrec); @@ -1390,7 +1390,7 @@ dissect_swils_mergereq (tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) else { offset += 4; } - + zonesetlen = tvb_get_ntohl (tvb, offset); proto_tree_add_text (mr_tree, tvb, offset, 4, "Full Zone Set Length: %d", zonesetlen); @@ -1400,10 +1400,10 @@ dissect_swils_mergereq (tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) /* Offset = start of the active zoneset zoning object list */ offset += 4; numrec = tvb_get_ntohl (tvb, offset); - + subti = proto_tree_add_text (mr_tree, tvb, offset, objlistlen, "Full Zone Set"); - + zobjlist_tree = proto_item_add_subtree (subti, ett_fcswils_zoneobjlist); proto_tree_add_text (zobjlist_tree, tvb, offset, 4, @@ -1445,10 +1445,10 @@ dissect_swils_aca (tvbuff_t *tvb, proto_tree *aca_tree, guint8 isreq) "Domain ID List Length: %d", plen); numrec = plen/4; offset = 4; - + for (i = 0; i < numrec; i++) { proto_tree_add_uint_format (aca_tree, hf_swils_aca_domainid, - tvb, offset+3, 1, + tvb, offset+3, 1, tvb_get_guint8 (tvb, offset+3), "Domain ID %d: %d", i, tvb_get_guint8 (tvb, offset+3)); @@ -1509,18 +1509,18 @@ dissect_swils_sfc (tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) proto_tree_add_string (sfc_tree, hf_swils_sfc_zonenm, tvb, offset+4, ZONENAME_LEN (tvb, offset+4), str); - - /* objlistlen gives the size of the active zoneset object list */ + + /* objlistlen gives the size of the active zoneset object list */ objlistlen = zonesetlen - ZONENAME_LEN (tvb, offset+4); /* Offset = start of the active zoneset zoning object list */ offset = offset + (4 + ZONENAME_LEN (tvb, offset+4)); numrec = tvb_get_ntohl (tvb, offset); - + subti = proto_tree_add_text (sfc_tree, tvb, offset, objlistlen, "Zone Set"); zobjlist_tree = proto_item_add_subtree (subti, ett_fcswils_zoneobjlist); - + proto_tree_add_text (zobjlist_tree, tvb, offset, 4, "Number of zoning objects: %d", numrec); @@ -1547,10 +1547,10 @@ dissect_swils_sfc (tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) /* Offset = start of the active zoneset zoning object list */ offset += 4; numrec = tvb_get_ntohl (tvb, offset); - + subti = proto_tree_add_text (sfc_tree, tvb, offset, objlistlen, "Full Zone Set"); - + zobjlist_tree = proto_item_add_subtree (subti, ett_fcswils_zoneobjlist); proto_tree_add_text (zobjlist_tree, tvb, offset, 4, @@ -1710,7 +1710,7 @@ dissect_swils_mrra (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) { int offset = 0; - + if (!tree) { return; } @@ -1732,7 +1732,7 @@ dissect_swils_mrra (tvbuff_t *tvb, proto_tree *tree, guint8 isreq) 4, 0); } - + } static fcswils_func_table_t fcswils_func_table[FC_SWILS_MAXCODE] = { @@ -1807,12 +1807,12 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvbuff_t *next_tvb; /* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "SW_ILS"); /* decoding of this is done by each individual opcode handler */ opcode = tvb_get_guint8 (tvb, 0); - + if (tree) { ti = proto_tree_add_protocol_format (tree, proto_fcswils, tvb, 0, tvb_length (tvb), "SW_ILS"); @@ -1829,25 +1829,25 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->ptype, pinfo->oxid, pinfo->rxid, NO_PORT2); } - + ckey.conv_idx = conversation->index; - + cdata = (fcswils_conv_data_t *)g_hash_table_lookup (fcswils_req_hash, &ckey); if (cdata) { /* Since we never free the memory used by an exchange, this maybe a * case of another request using the same exchange as a previous - * req. + * req. */ cdata->opcode = opcode; } else { req_key = se_alloc (sizeof(fcswils_conv_key_t)); req_key->conv_idx = conversation->index; - + cdata = se_alloc (sizeof(fcswils_conv_data_t)); cdata->opcode = opcode; - + g_hash_table_insert (fcswils_req_hash, req_key, cdata); } } @@ -1876,7 +1876,7 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else failed_opcode = cdata->opcode; } - + if (tree) { if ((cdata == NULL) && (opcode != FC_SWILS_SWRJT)) { /* No record of what this accept is for. Can't decode */ @@ -1911,7 +1911,7 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fcswils_func_table[opcode].func (tvb, swils_tree, isreq); } else if (opcode == FC_SWILS_AUTH_ILS) { /* This is treated differently */ - if (isreq && fcsp_handle) + if (isreq && fcsp_handle) call_dissector (fcsp_handle, tvb, pinfo, swils_tree); } else { /* data dissector */ @@ -2105,7 +2105,7 @@ proto_register_fcswils (void) {"Event Type", "swils.rscn.evtype", FT_UINT8, BASE_DEC, VALS (fc_swils_rscn_portstate_val), 0xF0, "", HFILL}}, { &hf_swils_rscn_addrfmt, - {"Address Format", "swils.rscn.addrfmt", FT_UINT8, BASE_DEC, + {"Address Format", "swils.rscn.addrfmt", FT_UINT8, BASE_DEC, VALS (fc_swils_rscn_addrfmt_val), 0x0F, "", HFILL}}, { &hf_swils_rscn_affectedport, {"Affected Port ID", "swils.rscn.affectedport", FT_STRING, BASE_HEX, @@ -2275,7 +2275,7 @@ proto_register_fcswils (void) FT_BOOLEAN, BASE_HEX, NULL, 0x20, "", HFILL}}, { &hf_swils_ess_fzs_adc_supp, {"Active Direct Command Supported", - "swils.ess.capability.fzs.adcsupp", FT_BOOLEAN, BASE_HEX, NULL, + "swils.ess.capability.fzs.adcsupp", FT_BOOLEAN, BASE_HEX, NULL, 0x40, "", HFILL}}, { &hf_swils_ess_fzs_hardzone, {"Hard Zoning Supported", "swils.ess.capability.fzs.hardzone", diff --git a/epan/dissectors/packet-fw1.c b/epan/dissectors/packet-fw1.c index 92d48a221a..132834e932 100644 --- a/epan/dissectors/packet-fw1.c +++ b/epan/dissectors/packet-fw1.c @@ -123,7 +123,7 @@ fw1_init(void) int i; for (i=0; irequest_uri = ep_strdup(request_uri); conv_data->request_uri = se_strdup(request_uri); @@ -1502,7 +1502,7 @@ http_payload_subdissector(tvbuff_t *next_tvb, proto_tree *tree, next_tvb, 0, 0, strings[0]); PROTO_ITEM_SET_GENERATED(item); - item = proto_tree_add_uint(sub_tree, hf_http_proxy_connect_port, + item = proto_tree_add_uint(sub_tree, hf_http_proxy_connect_port, next_tvb, 0, 0, strtol(strings[1], NULL, 10) ); PROTO_ITEM_SET_GENERATED(item); diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 1c5e6aa8a9..7c2cb96b8d 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -405,14 +405,14 @@ static void dissect_imf_content_type(tvbuff_t *tvb, int offset, int length, prot len = first_colon - offset; proto_tree_add_item(ct_tree, hf_imf_content_type_type, tvb, offset, len, FALSE); if(type) - /* this string must be freed */ - (*type) = tvb_get_string(tvb, offset, len); + /* This string will be automatically freed */ + (*type) = tvb_get_ephemeral_string(tvb, offset, len); len = length - (first_colon + 1 - offset); proto_tree_add_item(ct_tree, hf_imf_content_type_parameters, tvb, first_colon + 1, len, FALSE); if(parameters) - /* this string must be freed */ - (*parameters) = tvb_get_string(tvb, first_colon + 1, len); + /* This string will be automatically freed */ + (*parameters) = tvb_get_ephemeral_string(tvb, first_colon + 1, len); } } @@ -596,13 +596,6 @@ static void dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissected = dissector_try_string(media_type_dissector_table, content_type_str, next_tvb, pinfo, tree); - g_free(content_type_str); - content_type_str = NULL; - - if(parameters) { - g_free(parameters); - parameters = NULL; - } } else { /* just show the lines or highlight the rest of the buffer as message text */ diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index c5922a7255..2a4dc94402 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -5169,7 +5169,7 @@ dissect_isup_generic_name_parameter(tvbuff_t *parameter_tvb, proto_tree *paramet guint8 indicator; gint gen_name_length; char *gen_name=NULL; - + gen_name=ep_alloc(MAXGNAME + 1); gen_name[0] = '\0'; gen_name_length = tvb_length(parameter_tvb) - 1; @@ -5177,13 +5177,13 @@ dissect_isup_generic_name_parameter(tvbuff_t *parameter_tvb, proto_tree *paramet proto_tree_add_uint(parameter_tree, hf_isup_generic_name_presentation, parameter_tvb, 1, 1, indicator); proto_tree_add_boolean(parameter_tree, hf_isup_generic_name_availability, parameter_tvb, 1, 1, indicator); proto_tree_add_uint(parameter_tree, hf_isup_generic_name_type, parameter_tvb, 1, 1, indicator); - gen_name = tvb_get_string(parameter_tvb,1,gen_name_length); + gen_name = tvb_get_ephemeral_string(parameter_tvb,1,gen_name_length); gen_name[gen_name_length] = '\0'; proto_tree_add_string(parameter_tree, hf_isup_generic_name_ia5, parameter_tvb, 2, gen_name_length, gen_name); proto_item_set_text(parameter_item, "Generic name: %s", gen_name); - + } - + /* ------------------------------------------------------------------ Dissector Parameter Generic digits */ diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c index e7c759ca66..30dca6d7c3 100644 --- a/epan/dissectors/packet-msrp.c +++ b/epan/dissectors/packet-msrp.c @@ -7,17 +7,17 @@ * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -257,7 +257,7 @@ void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) p_add_proto_data(pinfo->fd, proto_msrp, p_conv_packet_data); } - } + } } /* Create setup info subtree with summary info. */ @@ -325,7 +325,7 @@ tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree) } } -/* This code is modeled on the code in packet-sip.c +/* This code is modeled on the code in packet-sip.c * ABNF code for the MSRP header: * The following syntax specification uses the augmented Backus-Naur * Form (BNF) as described in RFC-2234 [6]. @@ -348,10 +348,10 @@ tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree) * Examples: * "MSRP 1234 SEND(CRLF)" * "MSRP 1234 200 OK(CRLF) - */ + */ static gboolean check_msrp_header(tvbuff_t *tvb) -{ +{ gint offset = 0; gint linelen; gint space_offset; @@ -496,7 +496,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ( !check_msrp_header(tvb)){ return 0; } - /* We have a MSRP header with at least three tokens + /* We have a MSRP header with at least three tokens * * Note that "tvb_find_line_end()" will return a value that * is not longer than what's in the buffer, so the @@ -543,7 +543,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Make entries in Protocol column and Info column on summary display */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSRP"); if (is_msrp_response){ if (check_col(pinfo->cinfo, COL_INFO)) { @@ -590,7 +590,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) reqresp_tree = proto_item_add_subtree(th, ett_msrp_reqresp); proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,FALSE); proto_tree_add_uint(reqresp_tree,hf_msrp_status_code,tvb,token_3_start,token_3_len, - atoi(tvb_get_string(tvb, token_3_start, token_3_len))); + atoi(tvb_get_ephemeral_string(tvb, token_3_start, token_3_len))); }else{ th = proto_tree_add_item(msrp_tree,hf_msrp_request_line,tvb,0,linelen,FALSE); @@ -609,7 +609,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msrp_headers_item = proto_tree_add_item(msrp_tree, hf_msrp_msg_hdr, tvb, offset,(end_line_offset - offset), FALSE); msrp_hdr_tree = proto_item_add_subtree(msrp_headers_item, ett_msrp_hdr); - /* + /* * Process the headers */ while (tvb_reported_length_remaining(tvb, offset) > 0 && offset < end_line_offset ) { @@ -751,9 +751,9 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msrp_end_tree = proto_item_add_subtree(ti, ett_msrp_end_line); proto_tree_add_item(msrp_end_tree,hf_msrp_transactionID,tvb,end_line_offset + 7,token_2_len,FALSE); - /* continuation-flag */ + /* continuation-flag */ proto_tree_add_item(msrp_end_tree,hf_msrp_cnt_flg,tvb,end_line_offset+end_line_len-1,1,FALSE); - + if (global_msrp_raw_text){ ti = proto_tree_add_text(tree, tvb, 0, -1,"Message Session Relay Protocol(as raw text)"); raw_tree = proto_item_add_subtree(ti, ett_msrp); diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index df21b4250b..5f89a3f4f5 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -1358,7 +1358,8 @@ static int mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, } if (mysql_showquery) { if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " { %s } ",tvb_get_string(tvb, offset, strlen)); + col_append_fstr(pinfo->cinfo, COL_INFO, " { %s } ", + tvb_get_ephemeral_string(tvb, offset, strlen)); } offset+= strlen; conn_data->state= RESPONSE_TABULAR; @@ -1400,7 +1401,7 @@ static int mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, strlen= my_tvb_strsize(tvb, offset); if (req_tree) { proto_tree_add_text(req_tree, tvb, offset, strlen, "Table name: %s", - tvb_get_string(tvb, offset, strlen)); + tvb_get_ephemeral_string(tvb, offset, strlen)); } offset+= strlen; conn_data->state= RESPONSE_TABULAR; diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 3cdcab7555..e36af60307 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -2031,7 +2031,7 @@ ndps_string(tvbuff_t* tvb, int hfinfo, proto_tree *ndps_tree, int offset, char * /* * ASCII. */ - string = tvb_get_string(tvb, foffset, str_length); + string = tvb_get_ephemeral_string(tvb, foffset, str_length); } else { /* * Unicode. diff --git a/epan/dissectors/packet-p_mul.c b/epan/dissectors/packet-p_mul.c index e1e8376801..14d07119e9 100644 --- a/epan/dissectors/packet-p_mul.c +++ b/epan/dissectors/packet-p_mul.c @@ -159,7 +159,7 @@ static const value_string pdu_vals[] = { { Request_PDU, "Request PDU" }, { Reject_PDU, "Reject PDU" }, { Release_PDU, "Release PDU" }, - { 0, NULL } + { 0, NULL } }; static enum_val_t decode_options[] = { @@ -332,10 +332,9 @@ static void dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo _U_, /* Checksum */ len = tvb_length (tvb); - value = tvb_get_string (tvb, 0, len); + value = tvb_get_ephemeral_string (tvb, 0, len); checksum1 = checksum (value, len, offset); checksum2 = tvb_get_ntohs (tvb, offset); - g_free (value); en = proto_tree_add_item (p_mul_tree, hf_checksum, tvb, offset, 2, FALSE); if (checksum1 == checksum2) { proto_item_append_text (en, " (correct)"); @@ -363,7 +362,7 @@ static void dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo _U_, message_id = tvb_get_ntohl (tvb, offset); proto_tree_add_item (p_mul_tree, hf_message_id, tvb, offset, 4, FALSE); offset += 4; - + proto_item_append_text (ti, ", MSID: %u", message_id); if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, ", MSID: %u", message_id); diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index 5b179a187c..6601269b28 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -138,7 +138,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr pppoe_tree = proto_item_add_subtree(ti, ett_pppoed_tags); tagstart = offset; - + /* Loop until all data seen or End-Of-List tag found */ while (tagstart <= payload_length-2 ) { @@ -151,7 +151,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr proto_tree_add_item(pppoe_tree, hf_pppoed_tag, tvb, tagstart, 2, FALSE); proto_tree_add_item(pppoe_tree, hf_pppoed_tag_length, tvb, tagstart+2, 2, FALSE); } - + /* Show tag data */ switch (poe_tag) { @@ -166,7 +166,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr if (check_col(pinfo->cinfo,COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " AC-Name='%s'", - tvb_get_string(tvb, tagstart+4, poe_tag_length)); + tvb_get_ephemeral_string(tvb, tagstart+4, poe_tag_length)); } break; case PPPOE_TAG_HOST_UNIQ: @@ -273,7 +273,7 @@ static void dissect_pppoed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(pppoe_tree, hf_pppoe_session_id, tvb, 2, 2, FALSE); proto_tree_add_item(pppoe_tree, hf_pppoe_payload_length, tvb, 4, 2, FALSE); } - + /* Now dissect any tags */ if (reported_payload_length > 0) { @@ -312,7 +312,7 @@ void proto_register_pppoed(void) NULL, 0x0, "", HFILL } }, - + /* Discovery tag fields */ { &hf_pppoed_tags, { "PPPoE Tags", "pppoed.tags", FT_NONE, BASE_NONE, diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 67655675be..f2933a7192 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -50,7 +50,7 @@ # include "inet_v6defs.h" #endif -#include +#include #include #include #include @@ -324,9 +324,9 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Find the end of the line. */ linelen = tvb_find_line_end_unquoted(tvb, offset, -1, &next_offset); - - - + + + /* * Line must contain at least e.g. "v=". */ @@ -417,7 +417,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_sdp_subdissector(tvb_new_subset(tvb,offset+tokenoffset, linelen-tokenoffset, linelen-tokenoffset), - pinfo, + pinfo, hf,sub_ti,&transport_info), offset = next_offset; } @@ -436,7 +436,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if(transport_info.media_proto[n]!=NULL) { /* Check if media protocol is RTP - * and stream decoding is enabled in preferences + * and stream decoding is enabled in preferences */ if(global_sdp_establish_conversation){ /* Check if media protocol is RTP */ @@ -447,7 +447,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_msrp = (strcmp(transport_info.media_proto[n],"msrp/tcp")==0); } } - + if(transport_info.connection_address!=NULL) { if(transport_info.connection_type!=NULL) { @@ -515,16 +515,16 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) g_snprintf(sdp_pi->summary_str, 50, "%s %s", sdp_pi->summary_str, str_dyn_pt); else g_snprintf(sdp_pi->summary_str, 50, "%s %d", sdp_pi->summary_str, transport_info.media[n].pt[i]); - } else + } else g_snprintf(sdp_pi->summary_str, 50, "%s %s", sdp_pi->summary_str, val_to_str(transport_info.media[n].pt[i], rtp_payload_type_short_vals, "%u")); } /* Free the hash table if we did't assigned it to a conv use it */ - if (set_rtp == FALSE) + if (set_rtp == FALSE) rtp_free_hash_dyn_payload(transport_info.media[n].rtp_dyn_payload); /* Create the T38 summary str for the Voip Call analysis */ - if (is_t38) g_snprintf(sdp_pi->summary_str, 50, "%s t38", sdp_pi->summary_str); + if (is_t38) g_snprintf(sdp_pi->summary_str, 50, "%s t38", sdp_pi->summary_str); } /* Free the remainded hash tables not used */ @@ -915,10 +915,10 @@ static void dissect_key_mgmt(tvbuff_t *tvb, packet_info * pinfo, proto_item * ti key_tree = proto_item_add_subtree(ti, ett_sdp_key_mgmt); next_offset = tvb_find_guint8(tvb,offset,-1,' '); - + if (next_offset == -1) return; - + tokenlen = next_offset - offset; prtcl_id = tvb_get_ephemeral_string(tvb, offset, tokenlen); @@ -956,7 +956,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr proto_tree *sdp_session_attribute_tree; gint offset, next_offset, tokenlen; guint8 *field_name; - + offset = 0; next_offset = 0; tokenlen = 0; @@ -975,7 +975,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr tvb, offset, tokenlen, FALSE); field_name = tvb_get_ephemeral_string(tvb, offset, tokenlen); - + offset = next_offset + 1; if (strcmp((char*)field_name, "ipbcp") == 0) { @@ -983,14 +983,14 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr if (offset == -1) return; - + next_offset = tvb_find_guint8(tvb,offset,-1,' '); - + if (next_offset == -1) return; - + tokenlen = next_offset - offset; - + proto_tree_add_item(sdp_session_attribute_tree,hf_ipbcp_version,tvb,offset,tokenlen,FALSE); offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); @@ -999,10 +999,10 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr return; tokenlen = tvb_find_line_end(tvb,offset,-1, &next_offset, FALSE); - - if (tokenlen == -1) + + if (tokenlen == -1) return; - + proto_tree_add_item(sdp_session_attribute_tree,hf_ipbcp_type,tvb,offset,tokenlen,FALSE); } else if (strcmp((char*)field_name, "key-mgmt") == 0) { tvbuff_t *key_tvb; @@ -1058,7 +1058,7 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, transport_info->media_port[transport_info->media_count] = (char*)tvb_get_ephemeral_string(tvb, offset, tokenlen); proto_tree_add_uint(sdp_media_tree, hf_media_port, tvb, offset, tokenlen, - atoi((char*)tvb_get_string(tvb, offset, tokenlen))); + atoi((char*)tvb_get_ephemeral_string(tvb, offset, tokenlen))); offset = next_offset + 1; next_offset = tvb_find_guint8(tvb,offset, -1, ' '); if(next_offset == -1) @@ -1078,7 +1078,7 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, /* XXX Remember Port */ proto_tree_add_uint(sdp_media_tree, hf_media_port, tvb, offset, tokenlen, - atoi((char*)tvb_get_string(tvb, offset, tokenlen))); + atoi((char*)tvb_get_ephemeral_string(tvb, offset, tokenlen))); offset = next_offset + 1; } @@ -1106,7 +1106,7 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, } else { tokenlen = next_offset - offset; } - + if (strcmp(transport_info->media_proto[transport_info->media_count], "RTP/AVP") == 0) { media_format = tvb_get_ephemeral_string(tvb, offset, tokenlen); @@ -1139,7 +1139,7 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, /* 14496-2, Annex G, Table G-1. -Table G-1 FLC table for profile_and_level_indication Profile/Level Code +Table G-1 FLC table for profile_and_level_indication Profile/Level Code */ static const value_string mpeg4es_level_indication_vals[] = { @@ -1178,7 +1178,7 @@ static const value_string mpeg4es_level_indication_vals[] = /* Reserved 01110011 - 10000000 */ { 0x81, "Hybrid Profile/Level 1" }, { 0x82, "Hybrid Profile/Level 2" }, - /* Reserved 10000011 - 10010000 */ + /* Reserved 10000011 - 10010000 */ { 0x91, "Advanced Real Time Simple Profile/Level 1" }, { 0x92, "Advanced Real Time Simple Profile/Level 2" }, { 0x93, "Advanced Real Time Simple Profile/Level 3" }, @@ -1241,7 +1241,7 @@ static const value_string h263_profile_vals[] = { 0, NULL }, }; -/* +/* * TODO: Make this a more generic routine to dissect fmtp parameters depending on media types */ static void @@ -1323,7 +1323,7 @@ static const sdp_names_t sdp_media_attribute_names[] = { { "rtpmap"}, /* 1 */ { "fmtp"}, /* 2 */ { "path"}, /* 3 */ - { "h248item"}, /* 4 */ + { "h248item"}, /* 4 */ }; static gint find_sdp_media_attribute_names(tvbuff_t *tvb, int offset, guint len) @@ -1377,7 +1377,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto offset = next_offset + 1; /* Value is the remainder of the line */ - attribute_value = tvb_get_string(tvb, offset, tvb_length_remaining(tvb, offset)); + attribute_value = tvb_get_ephemeral_string(tvb, offset, tvb_length_remaining(tvb, offset)); @@ -1426,14 +1426,14 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto m=audio 49172 RTP/AVP 97 101 a=rtpmap:97 G726-24/8000 - The Media attributes ("a="s) after the "m=" only apply for that "m=". + The Media attributes ("a="s) after the "m=" only apply for that "m=". If there is an "a=" before the first "m=", that attribute applies for all the session (all the "m="s). */ /* so, if this "a=" appear before any "m=", we add it to all the dynamic * hash tables - */ + */ if (transport_info->media_count == 0) { for (n=0; n < SDP_MAX_RTP_CHANNELS; n++) { if (n==0) @@ -1494,7 +1494,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto offset, tokenlen, FALSE); fmtp_tree = proto_item_add_subtree(fmtp_item, ett_sdp_fmtp); - + decode_sdp_fmtp(fmtp_tree, tvb, offset, tokenlen, (guint8 *)transport_info->encoding_name); @@ -1540,7 +1540,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto case SDP_H248_ITEM: /* Decode h248 item ITU-T Rec. H.248.12 (2001)/Amd.1 (11/2002)*/ if (strncmp((char*)attribute_value, h324ext_h223lcparm, strlen(msrp_res)) == 0){ - /* A.5.1.3 H.223 Logical channel parameters + /* A.5.1.3 H.223 Logical channel parameters * This property indicates the H.245 * H223LogicalChannelsParameters structure encoded by applying the PER specified in * ITU-T Rec. X.691. Value encoded as per A.5.1.2. For text encoding the mechanism defined @@ -1622,7 +1622,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto asn1_ctx_init(&actx, ASN1_ENC_PER, TRUE, pinfo); dissect_h245_H223LogicalChannelParameters(h245_tvb, 0, &actx, sdp_media_attribute_tree, hf_SDPh223LogicalChannelParameters); } - + } break; default: @@ -1913,7 +1913,7 @@ proto_register_sdp(void) "Specifies that RTP/RTCP/T.38/MSRP/etc streams are decoded based " "upon port numbers found in SIP/SDP payload", &global_sdp_establish_conversation); - + /* * Register the dissector by name, so other dissectors can * grab it by name rather than just referring to it directly. -- cgit v1.2.3