Use tvb_ip_to_str().

There's no need to pass the result of tvb_get_ptr() as the 'value' in
proto_tree_add_*(): just use proto_tree_add_item().

Replace some tvb_get_ptr()s with tvb_get_ephemeral_string()s to ensure the
return string is NULL terminated.

svn path=/trunk/; revision=35545
This commit is contained in:
Jeff Morriss 2011-01-16 03:29:03 +00:00
parent 1f19cd8f1b
commit 067a076179
9 changed files with 98 additions and 133 deletions

View File

@ -60,7 +60,7 @@ dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *aruba_adp_tree = NULL;
guint16 type;
const guint8 *src_mac;
const guint8 *switchip;
const gchar *switchip;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ADP");
@ -76,7 +76,7 @@ dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
type = tvb_get_ntohs(tvb, 2);
if (tree) {
proto_tree_add_item(aruba_adp_tree, hf_adp_type, tvb, 2, 2, FALSE);
proto_tree_add_item(aruba_adp_tree, hf_adp_type, tvb, 2, 2, FALSE);
proto_tree_add_item(aruba_adp_tree, hf_adp_id, tvb, 4, 2, FALSE);
}
@ -92,21 +92,21 @@ dissect_aruba_adp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_append_text(ti, ", Request Src MAC: %s", ether_to_str(src_mac));
break;
case ADP_RESPONSE:
proto_tree_add_item(aruba_adp_tree, hf_adp_switchip, tvb, 6, 4, FALSE);
switchip = tvb_get_ptr(tvb, 6, 4);
switchip = tvb_ip_to_str(tvb, 6);
if (check_col(pinfo->cinfo, COL_INFO))
col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Response Switch IP: %s", ip_to_str(switchip));
proto_item_append_text(ti, ", Response Switch IP: %s", ip_to_str(switchip));
col_add_fstr(pinfo->cinfo, COL_INFO, "ADP Response Switch IP: %s", switchip);
proto_item_append_text(ti, ", Response Switch IP: %s", switchip);
break;
default:
break;
}
}

View File

@ -183,7 +183,6 @@ dissect sec_rgy_pname const signed32 sec_rgy_pname_t_size = 257; * In
typedef [string] char sec_rgy_pname_t[sec_rgy_pname_t_size];
*/
guint32 string_size;
const guint8 *namestring;
dcerpc_info *di;
di = pinfo->private_data;
@ -200,25 +199,21 @@ dissect sec_rgy_pname const signed32 sec_rgy_pname_t_size = 257; * In
tree = proto_item_add_subtree (item, ett_sec_rgy_pname_t);
}
offset =
dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
hf_sec_rgy_pname_t_size, &string_size);
offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
hf_sec_rgy_pname_t_size, &string_size);
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, " String_size:%u", string_size);
if (string_size < sec_rgy_pname_t_size)
{
/* proto_tree_add_string(tree, id, tvb, start, length, value_ptr); */
proto_tree_add_string (tree, hf_sec_rgy_pname_t_principalName_string,
tvb, offset, string_size, tvb_get_ptr (tvb,
offset,
string_size));
proto_tree_add_item (tree, hf_sec_rgy_pname_t_principalName_string,
tvb, offset, string_size, ENC_NA);
if (string_size > 1)
{
namestring = tvb_get_ptr (tvb, offset, string_size);
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, " Principal:%s",
namestring);
tvb_get_ephemeral_string(tvb, offset, string_size));
}
offset += string_size;
}
@ -409,7 +404,6 @@ dissect_sec_rgy_name_t (tvbuff_t * tvb, int offset,
#define sec_rgy_name_t_size 1025
/* typedef [string] char sec_rgy_name_t[sec_rgy_name_t_size]; */
guint32 string_size;
const guint8 *namestring;
dcerpc_info *di;
di = pinfo->private_data;
@ -435,16 +429,13 @@ dissect_sec_rgy_name_t (tvbuff_t * tvb, int offset,
{
/* proto_tree_add_string(tree, id, tvb, start, length, value_ptr); */
proto_tree_add_string (tree, hf_sec_rgy_name_t_principalName_string,
tvb, offset, string_size, tvb_get_ptr (tvb,
offset,
string_size));
proto_tree_add_item (tree, hf_sec_rgy_name_t_principalName_string,
tvb, offset, string_size, ENC_NA);
if (string_size > 1)
{
namestring = tvb_get_ptr (tvb, offset, string_size);
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, " Principal:%s",
namestring);
tvb_get_ephemeral_string (tvb, offset, string_size));
}
offset += string_size;
}

View File

@ -943,8 +943,7 @@ dissect_dcom_tobedone_data(tvbuff_t *tvb, int offset,
proto_item *item;
item = proto_tree_add_bytes(tree, hf_dcom_tobedone, tvb, offset, length,
tvb_get_ptr(tvb, offset, length));
item = proto_tree_add_item(tree, hf_dcom_tobedone, tvb, offset, length, ENC_NA);
PROTO_ITEM_SET_GENERATED(item);
expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Dissection incomplete");
@ -963,8 +962,7 @@ dissect_dcom_nospec_data(tvbuff_t *tvb, int offset,
proto_item *item;
item = proto_tree_add_bytes(tree, hf_dcom_nospec, tvb, offset, length,
tvb_get_ptr(tvb, offset, length));
item = proto_tree_add_item(tree, hf_dcom_nospec, tvb, offset, length, ENC_NA);
PROTO_ITEM_SET_GENERATED(item);
expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE, "No specification available, dissection not possible");

View File

@ -602,9 +602,8 @@ do_initialization_msg(
my_offset += 2;
remainder_count = tvb_get_guint8(tvb, my_offset);
if (remainder_count != 0) {
proto_tree_add_bytes(tree, hf_dec_rt_reserved, tvb,
my_offset, remainder_count,
tvb_get_ptr(tvb, my_offset, remainder_count));
proto_tree_add_item(tree, hf_dec_rt_reserved, tvb,
my_offset, remainder_count, ENC_NA);
my_offset += remainder_count;
}
return (my_offset);
@ -626,9 +625,8 @@ do_verification_msg(
offset += 2;
remainder_count = tvb_get_guint8(tvb, my_offset);
if (remainder_count != 0) {
proto_tree_add_bytes(tree, hf_dec_rt_fcnval, tvb,
my_offset, remainder_count,
tvb_get_ptr(tvb, my_offset, remainder_count));
proto_tree_add_item(tree, hf_dec_rt_fcnval, tvb,
my_offset, remainder_count, ENC_NA);
my_offset += remainder_count;
}
return (my_offset);
@ -650,9 +648,8 @@ do_hello_test_msg(
my_offset += 2;
remainder_count = tvb_length_remaining(tvb, my_offset);
if (remainder_count != 0) {
proto_tree_add_bytes(tree, hf_dec_rt_test_data, tvb,
my_offset, remainder_count,
tvb_get_ptr(tvb, my_offset, remainder_count));
proto_tree_add_item(tree, hf_dec_rt_test_data, tvb,
my_offset, remainder_count, ENC_NA);
my_offset += remainder_count;
}
return (my_offset);
@ -824,8 +821,8 @@ do_hello_msg(
tvb, my_offset, 1, "Router States");
list_tree = proto_item_add_subtree(ti_locala, ett_dec_rt_list);
while (image_len > 0) {
ti_ether = proto_tree_add_bytes(list_tree, hf_dec_rt_ename, tvb,
my_offset, 7, tvb_get_ptr(tvb, my_offset, 7));
ti_ether = proto_tree_add_item(list_tree, hf_dec_rt_ename, tvb,
my_offset, 7, ENC_NA);
list_ether = proto_item_add_subtree(ti_ether, ett_dec_rt_rlist);
my_offset += 7;
image_len -= 7;

View File

@ -1064,9 +1064,9 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
/* Yes - dissect it. */
if (tree) {
proto_tree_add_string (fc_tree, hf_fc_nh_da, tvb, next_offset, 8,
fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
fcwwn_to_str (tvb_get_ephemeral_string (tvb, offset, 8)));
proto_tree_add_string (fc_tree, hf_fc_nh_sa, tvb, offset+8, 8,
fcwwn_to_str (tvb_get_ptr (tvb, offset+8, 8)));
fcwwn_to_str (tvb_get_ephemeral_string (tvb, offset+8, 8)));
}
next_offset += 16;
}

View File

@ -14,17 +14,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.
@ -53,17 +53,17 @@
#include "packet-fc.h"
/* Message Codes */
#define FC_AUTH_MSG_AUTH_REJECT 0x0A
#define FC_AUTH_MSG_AUTH_NEGOTIATE 0x0B
#define FC_AUTH_MSG_AUTH_DONE 0x0C
#define FC_AUTH_DHCHAP_CHALLENGE 0x10
#define FC_AUTH_DHCHAP_REPLY 0x11
#define FC_AUTH_DHCHAP_SUCCESS 0x12
#define FC_AUTH_FCAP_REQUEST 0x13
#define FC_AUTH_FCAP_ACKNOWLEDGE 0x14
#define FC_AUTH_FCAP_CONFIRM 0x15
#define FC_AUTH_FCPAP_INIT 0x16
#define FC_AUTH_FCPAP_ACCEPT 0x17
#define FC_AUTH_MSG_AUTH_REJECT 0x0A
#define FC_AUTH_MSG_AUTH_NEGOTIATE 0x0B
#define FC_AUTH_MSG_AUTH_DONE 0x0C
#define FC_AUTH_DHCHAP_CHALLENGE 0x10
#define FC_AUTH_DHCHAP_REPLY 0x11
#define FC_AUTH_DHCHAP_SUCCESS 0x12
#define FC_AUTH_FCAP_REQUEST 0x13
#define FC_AUTH_FCAP_ACKNOWLEDGE 0x14
#define FC_AUTH_FCAP_CONFIRM 0x15
#define FC_AUTH_FCPAP_INIT 0x16
#define FC_AUTH_FCPAP_ACCEPT 0x17
#define FC_AUTH_FCPAP_COMPLETE 0x18
#define FC_AUTH_NAME_TYPE_WWN 0x1
@ -190,11 +190,11 @@ static void dissect_fcsp_dhchap_auth_param (tvbuff_t *tvb, proto_tree *tree,
{
guint16 auth_param_tag;
guint16 param_len = 0, i;
if (tree) {
auth_param_tag = tvb_get_ntohs (tvb, offset);
total_len -= 4;
while (total_len > 0) {
proto_tree_add_item (tree, hf_auth_dhchap_param_tag, tvb, offset,
2, 0);
@ -237,7 +237,7 @@ static void dissect_fcsp_dhchap_challenge (tvbuff_t *tvb, proto_tree *tree)
int offset = 12;
guint16 name_type;
guint16 param_len, name_len;
if (tree) {
proto_tree_add_item (tree, hf_auth_responder_name_type, tvb, offset,
2, 0);
@ -247,7 +247,7 @@ static void dissect_fcsp_dhchap_challenge (tvbuff_t *tvb, proto_tree *tree)
2, 0);
name_len = tvb_get_ntohs (tvb, offset+2);
if (name_type == FC_AUTH_NAME_TYPE_WWN) {
proto_tree_add_string (tree, hf_auth_responder_wwn, tvb, offset+4,
8,
@ -255,11 +255,11 @@ static void dissect_fcsp_dhchap_challenge (tvbuff_t *tvb, proto_tree *tree)
8)));
}
else {
proto_tree_add_bytes (tree, hf_auth_responder_name, tvb, offset+4,
name_len, tvb_get_ptr (tvb, offset+4, name_len));
proto_tree_add_item (tree, hf_auth_responder_name, tvb, offset+4,
name_len, ENC_NA);
}
offset += (4+name_len);
proto_tree_add_item (tree, hf_auth_dhchap_hash_type, tvb, offset,
4, 0);
proto_tree_add_item (tree, hf_auth_dhchap_group_type, tvb, offset+4,
@ -267,18 +267,16 @@ static void dissect_fcsp_dhchap_challenge (tvbuff_t *tvb, proto_tree *tree)
proto_tree_add_item (tree, hf_auth_dhchap_chal_len, tvb, offset+8,
4, 0);
param_len = tvb_get_ntohl (tvb, offset+8);
proto_tree_add_bytes (tree, hf_auth_dhchap_chal_value, tvb, offset+12,
param_len,
tvb_get_ptr (tvb, offset+12, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_chal_value, tvb, offset+12,
param_len, ENC_NA);
offset += (param_len + 12);
proto_tree_add_item (tree, hf_auth_dhchap_val_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
proto_tree_add_bytes (tree, hf_auth_dhchap_dhvalue, tvb, offset+4,
param_len,
tvb_get_ptr (tvb, offset+4, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_dhvalue, tvb, offset+4,
param_len, ENC_NA);
}
}
@ -287,30 +285,27 @@ static void dissect_fcsp_dhchap_reply (tvbuff_t *tvb, proto_tree *tree)
{
int offset = 12;
guint32 param_len;
if (tree) {
proto_tree_add_item (tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
proto_tree_add_bytes (tree, hf_auth_dhchap_rsp_value, tvb, offset+4,
param_len,
tvb_get_ptr (tvb, offset+4, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_rsp_value, tvb, offset+4,
param_len, ENC_NA);
offset += (param_len + 4);
proto_tree_add_item (tree, hf_auth_dhchap_val_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
proto_tree_add_bytes (tree, hf_auth_dhchap_dhvalue, tvb, offset+4,
param_len,
tvb_get_ptr (tvb, offset+4, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_dhvalue, tvb, offset+4,
param_len, ENC_NA);
offset += (param_len + 4);
proto_tree_add_item (tree, hf_auth_dhchap_chal_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
proto_tree_add_bytes (tree, hf_auth_dhchap_chal_value, tvb, offset+4,
param_len,
tvb_get_ptr (tvb, offset+4, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_chal_value, tvb, offset+4,
param_len, ENC_NA);
}
}
@ -318,14 +313,13 @@ static void dissect_fcsp_dhchap_success (tvbuff_t *tvb, proto_tree *tree)
{
int offset = 12;
guint32 param_len;
if (tree) {
proto_tree_add_item (tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
proto_tree_add_bytes (tree, hf_auth_dhchap_rsp_value, tvb, offset+4,
param_len,
tvb_get_ptr (tvb, offset+4, param_len));
proto_tree_add_item (tree, hf_auth_dhchap_rsp_value, tvb, offset+4,
param_len, ENC_NA);
}
}
@ -350,9 +344,8 @@ static void dissect_fcsp_auth_negotiate (tvbuff_t *tvb, proto_tree *tree)
fcwwn_to_str (tvb_get_ptr (tvb, offset+4, 8)));
}
else {
proto_tree_add_bytes (tree, hf_auth_initiator_name, tvb, offset+4,
name_len, tvb_get_ptr (tvb, offset+4,
name_len));
proto_tree_add_item (tree, hf_auth_initiator_name, tvb, offset+4,
name_len, ENC_NA);
}
offset += (4+name_len);
@ -360,12 +353,12 @@ static void dissect_fcsp_auth_negotiate (tvbuff_t *tvb, proto_tree *tree)
proto_tree_add_item (tree, hf_auth_usable_proto, tvb, offset, 4, 0);
num_protos = tvb_get_ntohl (tvb, offset);
offset += 4;
for (i = 0; i < num_protos; i++) {
proto_tree_add_item (tree, hf_auth_proto_param_len, tvb, offset, 4, 0);
param_len = tvb_get_ntohl (tvb, offset);
offset += 4;
if (tvb_bytes_exist (tvb, offset, param_len)) {
proto_type = tvb_get_ntohl (tvb, offset);
@ -392,7 +385,7 @@ static void dissect_fcsp_auth_done (tvbuff_t *tvb _U_, proto_tree *tree _U_)
static void dissect_fcsp_auth_rjt (tvbuff_t *tvb, proto_tree *tree)
{
int offset = 12;
if (tree) {
proto_tree_add_item (tree, hf_auth_rjt_code, tvb, offset, 1, 0);
proto_tree_add_item (tree, hf_auth_rjt_codedet, tvb, offset+1, 1, 0);
@ -413,7 +406,7 @@ static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_add_str (pinfo->cinfo, COL_INFO,
val_to_str (opcode, fcauth_msgcode_vals, "0x%x"));
}
if (tree) {
ti = proto_tree_add_protocol_format (tree, proto_fcsp, tvb, 0,
tvb_length (tvb), "FC-SP");
@ -462,7 +455,7 @@ static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void
proto_register_fcsp (void)
{
{
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
{ &hf_auth_proto_ver,
@ -555,7 +548,7 @@ proto_register_fcsp (void)
{ &hf_auth_dhchap_rsp_value,
{"Response Value", "fcsp.dhchap.rspval", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL}},
};

View File

@ -320,7 +320,7 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (bitswapped)
swap_mac_addr(dst, tvb_get_ptr(tvb, FDDI_P_DHOST + FDDI_PADDING, 6));
else
memcpy(dst, tvb_get_ptr(tvb, FDDI_P_DHOST + FDDI_PADDING, 6), sizeof dst);
tvb_memcpy(tvb, dst, FDDI_P_DHOST + FDDI_PADDING, sizeof(dst));
swap_mac_addr(dst_swapped, tvb_get_ptr(tvb, FDDI_P_DHOST + FDDI_PADDING, 6));
/* XXX - copy them to some buffer associated with "pi", rather than
@ -345,7 +345,7 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (bitswapped)
swap_mac_addr(src, tvb_get_ptr(tvb, FDDI_P_SHOST + FDDI_PADDING, 6));
else
memcpy(src, tvb_get_ptr(tvb, FDDI_P_SHOST + FDDI_PADDING, 6), sizeof src);
tvb_memcpy(tvb, src, FDDI_P_SHOST + FDDI_PADDING, sizeof(src));
swap_mac_addr(src_swapped, tvb_get_ptr(tvb, FDDI_P_SHOST + FDDI_PADDING, 6));
/* XXX - copy them to some buffer associated with "pi", rather than

View File

@ -518,7 +518,7 @@ proto_add_icq_attr(proto_tree* tree, /* The tree to add to */
return -1; /* length goes past end of packet */
proto_tree_add_text(tree, tvb, offset, sizeof(guint16) + len,
"%s[%u]: %.*s", descr, len, len,
tvb_get_ptr(tvb, offset + sizeof(guint16), len));
tvb_get_ephemeral_string(tvb, offset + sizeof(guint16), len));
return len + sizeof(guint16);
}
@ -595,7 +595,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
break;
case MSG_TEXT:
proto_tree_add_text(subtree, tvb, offset, left, "Msg: %.*s", left-1,
tvb_get_ptr(tvb, offset, left));
tvb_get_ephemeral_string(tvb, offset, left));
break;
case MSG_URL:
for (n = 0; n < N_URL_FIELDS; n++) {
@ -608,7 +608,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
proto_tree_add_text(subtree, tvb, offset, sz, "%s: %.*s",
url_field_descr[n],
sz - 1,
tvb_get_ptr(tvb, offset, sz));
tvb_get_ephemeral_string(tvb, offset, sz));
} else {
proto_tree_add_text(subtree, tvb, offset, 0,
"%s: %s", url_field_descr[n], "(empty)");
@ -628,7 +628,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
proto_tree_add_text(subtree, tvb, offset, sz, "%s: %.*s",
email_field_descr[n],
sz - 1,
tvb_get_ptr(tvb, offset, sz));
tvb_get_ephemeral_string(tvb, offset, sz));
} else {
proto_tree_add_text(subtree, tvb, offset, 0, "%s: %s",
email_field_descr[n], "(empty)");
@ -662,7 +662,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
if (sz != 0) {
proto_tree_add_text(subtree, tvb, offset, sz, "%s: %.*s",
auth_req_field_descr[n], sz - 1,
tvb_get_ptr(tvb, offset, sz));
tvb_get_ephemeral_string(tvb, offset, sz));
} else {
proto_tree_add_text(subtree, tvb, offset, 0, "%s: %s",
auth_req_field_descr[n], "(empty)");
@ -681,7 +681,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
if (sz != 0) {
proto_tree_add_text(subtree, tvb, offset, sz, "%s: %.*s",
user_added_field_descr[n], sz - 1,
tvb_get_ptr(tvb, offset, sz));
tvb_get_ephemeral_string(tvb, offset, sz));
} else {
proto_tree_add_text(subtree, tvb, offset, 0, "%s: %s",
user_added_field_descr[n], "(empty)");
@ -709,7 +709,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
/* The first element is the number of Nick/UIN pairs follow */
proto_tree_add_text(subtree, tvb, offset, sz_local,
"Number of pairs: %.*s", sz_local - 1,
tvb_get_ptr(tvb, offset, sz_local));
tvb_get_ephemeral_string(tvb, offset, sz_local));
n_local++;
} else if (!last) {
int svsz = sz_local;
@ -725,8 +725,8 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
}
proto_tree_add_text(subtree, tvb, offset, sz_local + svsz,
"%.*s: %.*s", svsz - 1,
tvb_get_ptr(tvb, offset, svsz), sz_local - 1,
tvb_get_ptr(tvb, sep_offset_prev + 1, sz_local));
tvb_get_ephemeral_string(tvb, offset, svsz), sz_local - 1,
tvb_get_ephemeral_string(tvb, sep_offset_prev + 1, sz_local));
n_local += 2;
}
@ -863,7 +863,7 @@ icqv5_cmd_send_text_code(proto_tree* tree, /* Tree to put the data in */
if (tree){
proto_tree_add_text(subtree, tvb, offset + CMD_SEND_TEXT_CODE_TEXT,
len, "Text: %.*s", len,
tvb_get_ptr(tvb, offset + CMD_SEND_TEXT_CODE_TEXT,
tvb_get_ephemeral_string(tvb, offset + CMD_SEND_TEXT_CODE_TEXT,
len));
}
}
@ -947,7 +947,6 @@ icqv5_cmd_login(proto_tree* tree, tvbuff_t *tvb, int offset, int size)
char *aTime;
guint32 port;
guint32 passwdLen;
const guchar *ipAddrp;
guint32 status;
if (tree) {
@ -963,14 +962,11 @@ icqv5_cmd_login(proto_tree* tree, tvbuff_t *tvb, int offset, int size)
passwdLen = tvb_get_letohs(tvb, offset + CMD_LOGIN_PASSLEN);
proto_tree_add_text(subtree, tvb, offset + CMD_LOGIN_PASSLEN,
2 + passwdLen, "Passwd: %.*s", (int)passwdLen,
tvb_get_ptr(tvb, offset + CMD_LOGIN_PASSWD,
tvb_get_ephemeral_string(tvb, offset + CMD_LOGIN_PASSWD,
passwdLen));
ipAddrp = tvb_get_ptr(tvb,
offset + CMD_LOGIN_PASSWD + passwdLen + CMD_LOGIN_IP,
4);
proto_tree_add_text(subtree, tvb,
offset + CMD_LOGIN_PASSWD + passwdLen + CMD_LOGIN_IP,
4, "IP: %s", ip_to_str(ipAddrp));
4, "IP: %s", tvb_ip_to_str(tvb, offset + CMD_LOGIN_PASSWD + passwdLen + CMD_LOGIN_IP));
status = tvb_get_letohs(tvb,
offset + CMD_LOGIN_PASSWD + passwdLen + CMD_LOGIN_STATUS);
proto_tree_add_text(subtree, tvb,
@ -1051,7 +1047,6 @@ icqv5_srv_login_reply(proto_tree* tree,/* Tree to put the data in */
{
proto_tree* subtree;
proto_item* ti;
const guchar *ipAddrp;
if (tree) {
if (size < SRV_LOGIN_REPLY_IP + 8) {
@ -1063,9 +1058,8 @@ icqv5_srv_login_reply(proto_tree* tree,/* Tree to put the data in */
ti = proto_tree_add_text(tree, tvb, offset, SRV_LOGIN_REPLY_IP + 8,
"Body");
subtree = proto_item_add_subtree(ti, ett_icq_body);
ipAddrp = tvb_get_ptr(tvb, offset + SRV_LOGIN_REPLY_IP, 4);
proto_tree_add_text(subtree, tvb, offset + SRV_LOGIN_REPLY_IP, 4,
"IP: %s", ip_to_str(ipAddrp));
"IP: %s", tvb_ip_to_str(tvb, offset + SRV_LOGIN_REPLY_IP));
}
}
@ -1077,8 +1071,6 @@ icqv5_srv_user_online(proto_tree* tree,/* Tree to put the data in */
{
proto_tree* subtree;
proto_item* ti;
const guchar *ipAddrp;
const guchar *realipAddrp;
guint32 status;
if (tree) {
@ -1094,15 +1086,13 @@ icqv5_srv_user_online(proto_tree* tree,/* Tree to put the data in */
proto_tree_add_text(subtree, tvb, offset + SRV_USER_ONL_UIN, 4,
"UIN: %u",
tvb_get_letohl(tvb, offset + SRV_USER_ONL_UIN));
ipAddrp = tvb_get_ptr(tvb, offset + SRV_USER_ONL_IP, 4);
proto_tree_add_text(subtree, tvb, offset + SRV_USER_ONL_IP, 4,
"IP: %s", ip_to_str(ipAddrp));
"IP: %s", tvb_ip_to_str(tvb, offset + SRV_USER_ONL_IP));
proto_tree_add_text(subtree, tvb, offset + SRV_USER_ONL_PORT, 4,
"Port: %u",
tvb_get_letohl(tvb, offset + SRV_USER_ONL_PORT));
realipAddrp = tvb_get_ptr(tvb, offset + SRV_USER_ONL_REALIP, 4);
proto_tree_add_text(subtree, tvb, offset + SRV_USER_ONL_REALIP, 4,
"RealIP: %s", ip_to_str(realipAddrp));
"RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_USER_ONL_REALIP));
status = tvb_get_letohs(tvb, offset + SRV_USER_ONL_STATUS);
proto_tree_add_text(subtree, tvb, offset + SRV_USER_ONL_STATUS, 2,
"Status: %s", findStatus(status));
@ -1283,7 +1273,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
offset+=sizeof(guint16);left-=sizeof(guint16);
proto_tree_add_text(sstree, tvb, offset - sizeof(guint16),
sizeof(guint16)+len, "About(%d): %.*s", len,
len, tvb_get_ptr(tvb, offset, len));
len, tvb_get_ephemeral_string(tvb, offset, len));
offset+=len;left-=len;
break;
}
@ -1332,7 +1322,7 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
proto_tree_add_text(sstree, tvb, offset - sizeof(guint16),
sizeof(guint16)+len, "%s(%d): %.*s",
*d, len, len - 1,
tvb_get_ptr(tvb, offset, len - 1));
tvb_get_ephemeral_string(tvb, offset, len - 1));
offset+=len;left-=len;
}
d++;
@ -1419,9 +1409,7 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */
proto_tree* subtree = NULL;
proto_item* ti = NULL;
guint32 uin;
const unsigned char* IP = NULL;
guint32 port;
const unsigned char* realIP = NULL;
guint8 commClass;
guint32 status;
guint16 tcpVer;
@ -1435,18 +1423,16 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN,
sizeof(guint32), "UIN: %u", uin);
/* guint32 IP */
IP = tvb_get_ptr(tvb, offset + SRV_RAND_USER_IP, 4);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_IP,
sizeof(guint32), "IP: %s", ip_to_str(IP));
sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP));
/* guint16 portNum */
/* XXX - 16 bits, or 32 bits? */
port = tvb_get_letohs(tvb, offset + SRV_RAND_USER_PORT);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN,
sizeof(guint32), "Port: %u", port);
/* guint32 realIP */
realIP = tvb_get_ptr(tvb, offset + SRV_RAND_USER_REAL_IP, 4);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_REAL_IP,
sizeof(guint32), "RealIP: %s", ip_to_str(realIP));
sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP));
/* guint8 Communication Class */
commClass = tvb_get_guint8(tvb, offset + SRV_RAND_USER_CLASS);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_CLASS,

View File

@ -461,7 +461,7 @@ dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp
proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
"Interface IPX_address = %s",
ipx_addr_to_str(tvb_get_ntohl(tvb, offset),
tvb_get_ptr(tvb, offset+4, tuple_length-4)));
tvb_get_ephemeral_string(tvb, offset+4, tuple_length-4)));
break;
case EDP_TUPLE_UNKNOWN:
default: