aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2011-01-16 20:51:21 +0000
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2011-01-16 20:51:21 +0000
commite7ea07c0bddf8f45ac652a040ce85eaf769a16aa (patch)
tree420d5401a47ed145c8aba98c7891e5f098f86e19 /epan/dissectors
parent45393f35e39fa3e077c1d784cb47de0b4074ee27 (diff)
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() or tvb_get_const_stringz(). Use tvb_memeql() & tvb_memcmp(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35558 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-mac-lte.c22
-rw-r--r--epan/dissectors/packet-meta.c18
-rw-r--r--epan/dissectors/packet-mmse.c4
-rw-r--r--epan/dissectors/packet-mount.c26
-rw-r--r--epan/dissectors/packet-msproxy.c22
-rw-r--r--epan/dissectors/packet-mysql.c4
-rw-r--r--epan/dissectors/packet-netbios.c6
-rw-r--r--epan/dissectors/packet-ntp.c8
-rw-r--r--epan/dissectors/packet-pagp.c7
-rw-r--r--epan/dissectors/packet-pktc.c2
-rw-r--r--epan/dissectors/packet-q2931.c6
-rw-r--r--epan/dissectors/packet-q931.c2
-rw-r--r--epan/dissectors/packet-q933.c4
-rw-r--r--epan/dissectors/packet-quake2.c4
-rw-r--r--epan/dissectors/packet-raw.c2
-rw-r--r--epan/dissectors/packet-rmt-lct.c3
-rw-r--r--epan/dissectors/packet-rmt-lct.h1
-rw-r--r--epan/dissectors/packet-sap.c6
-rw-r--r--epan/dissectors/packet-scsi.c30
-rw-r--r--epan/dissectors/packet-slowprotocols.c72
-rw-r--r--epan/dissectors/packet-smb-browse.c3
-rw-r--r--epan/dissectors/packet-smb-common.c3
-rw-r--r--epan/dissectors/packet-smb-pipe.c13
-rw-r--r--epan/dissectors/packet-smb.c3
-rw-r--r--epan/dissectors/packet-smpp.c12
-rw-r--r--epan/dissectors/packet-socks.c2
-rw-r--r--epan/dissectors/packet-srvloc.c4
-rw-r--r--epan/dissectors/packet-ssl.c7
-rw-r--r--epan/dissectors/packet-trmac.c4
-rw-r--r--epan/dissectors/packet-uma.c19
-rw-r--r--epan/dissectors/packet-vmlab.c6
-rw-r--r--epan/dissectors/packet-wbxml.c11
-rw-r--r--epan/dissectors/packet-zbee-zcl.c3
33 files changed, 142 insertions, 197 deletions
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c
index 28be0e4688..9c67d26f37 100644
--- a/epan/dissectors/packet-mac-lte.c
+++ b/epan/dissectors/packet-mac-lte.c
@@ -908,7 +908,7 @@ static gboolean dissect_mac_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
default:
break;
}
-
+
/* Read optional fields */
while (tag != MAC_LTE_PAYLOAD_TAG) {
/* Process next tag */
@@ -1642,9 +1642,7 @@ static int DetectIfDLHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatile int
/* Compare time, ndi, data to see if this looks like a retx */
if ((tvb_length_remaining(tvb, offset) == lastData->length) &&
(p_mac_lte_info->detailed_phy_info.dl_info.ndi == lastData->ndi) &&
- (memcmp(lastData->data,
- tvb_get_ptr(tvb, offset, lastData->length),
- MIN(lastData->length, MAX_EXPECTED_PDU_LENGTH)) == 0)) {
+ tvb_memeql(tvb, offset, lastData->data, MIN(lastData->length, MAX_EXPECTED_PDU_LENGTH)) == 0) {
/* Work out gap between frames */
gint seconds_between_packets = (gint)
@@ -1685,9 +1683,7 @@ static int DetectIfDLHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatile int
thisData = &(ueData->harqid[transport_block-1][harq_id]);
thisData->inUse = TRUE;
thisData->length = tvb_length_remaining(tvb, offset);
- memcpy(thisData->data,
- tvb_get_ptr(tvb, offset, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH)),
- MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH));
+ tvb_memcpy(tvb, thisData->data, offset, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH));
thisData->ndi = p_mac_lte_info->detailed_phy_info.dl_info.ndi;
thisData->framenum = pinfo->fd->num;
thisData->received_time = pinfo->fd->abs_ts;
@@ -1776,9 +1772,7 @@ static void TrackReportedULHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatil
/* Compare time, sf, data to see if this looks like a retx */
if ((tvb_length_remaining(tvb, offset) == lastData->length) &&
(p_mac_lte_info->detailed_phy_info.ul_info.ndi == lastData->ndi) &&
- (memcmp(lastData->data,
- tvb_get_ptr(tvb, offset, lastData->length),
- MIN(lastData->length, MAX_EXPECTED_PDU_LENGTH)) == 0)) {
+ tvb_memeql(tvb, offset, lastData->data, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH)) == 0) {
/* Work out gap between frames */
gint seconds_between_packets = (gint)
@@ -1811,9 +1805,7 @@ static void TrackReportedULHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatil
thisData = &(ueData->harqid[p_mac_lte_info->detailed_phy_info.ul_info.harq_id]);
thisData->inUse = TRUE;
thisData->length = tvb_length_remaining(tvb, offset);
- memcpy(thisData->data,
- tvb_get_ptr(tvb, offset, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH)),
- MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH));
+ tvb_memcpy(tvb, thisData->data, offset, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH));
thisData->ndi = p_mac_lte_info->detailed_phy_info.ul_info.ndi;
thisData->framenum = pinfo->fd->num;
thisData->received_time = pinfo->fd->abs_ts;
@@ -2397,7 +2389,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
crResult->msg3FrameNum = msg3Data->framenum;
/* Compare the 6 bytes */
- if (memcmp(&msg3Data->data, tvb_get_ptr(tvb, offset, 6), 6) == 0) {
+ if (tvb_memeql(tvb, offset, msg3Data->data, 6) == 0) {
crResult->status = Msg3Match;
}
else {
@@ -2740,7 +2732,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* Fill in data details */
data->framenum = pinfo->fd->num;
- memcpy(&data->data, tvb_get_ptr(tvb, offset, data_length), data_length);
+ tvb_memcpy(tvb, data->data, offset, data_length);
data->msg3Time = pinfo->fd->abs_ts;
}
}
diff --git a/epan/dissectors/packet-meta.c b/epan/dissectors/packet-meta.c
index 71c91a14fa..9e59a7877c 100644
--- a/epan/dissectors/packet-meta.c
+++ b/epan/dissectors/packet-meta.c
@@ -175,8 +175,8 @@ static guint16 skip_item(proto_tree *meta_tree, tvbuff_t *tvb, packet_info *pinf
proto_tree_add_uint(item_tree, hf_meta_item_len,
tvb, offs - 1, 1, len);
if (len > 0)
- proto_tree_add_bytes(item_tree, hf_meta_item_data,
- tvb, offs, len, tvb_get_ptr(tvb, offs, len));
+ proto_tree_add_item(item_tree, hf_meta_item_data,
+ tvb, offs, len, ENC_NA);
return total_len;
}
@@ -227,8 +227,8 @@ static guint16 evaluate_meta_item_pcap(proto_tree *meta_tree, tvbuff_t *tvb, pac
proto_tree_add_uint(item_tree, hf_meta_item_len,
tvb, offs - 1, 1, len);
if (len > 0)
- proto_tree_add_bytes(item_tree, hf_meta_item_data,
- tvb, offs, len, tvb_get_ptr(tvb, offs, len));
+ proto_tree_add_item(item_tree, hf_meta_item_data,
+ tvb, offs, len, ENC_NA);
}
return total_len;
}
@@ -322,7 +322,7 @@ static guint16 evaluate_meta_item_dxt(proto_tree *meta_tree, tvbuff_t *tvb, pack
}
switch (aal5proto) {
case META_AAL5PROTO_MTP3:
- p_sscop_info->subdissector = sscf_nni_handle;
+ p_sscop_info->subdissector = sscf_nni_handle;
break;
case META_AAL5PROTO_ALCAP:
p_sscop_info->subdissector = alcap_handle;
@@ -377,8 +377,8 @@ static guint16 evaluate_meta_item_dxt(proto_tree *meta_tree, tvbuff_t *tvb, pack
proto_tree_add_uint(item_tree, hf_meta_item_len,
tvb, offs - 1, 1, len);
if (len > 0)
- proto_tree_add_bytes(item_tree, hf_meta_item_data,
- tvb, offs, len, tvb_get_ptr(tvb, offs, len));
+ proto_tree_add_item(item_tree, hf_meta_item_data,
+ tvb, offs, len, ENC_NA);
}
return total_len;
}
@@ -405,7 +405,7 @@ static gint32 evaluate_meta_items(guint16 schema, tvbuff_t *tvb, packet_info *pi
}
if (item_len < 4) { /* 4 is the minimum length of an item: id + type + length field */
proto_item *malformed;
- malformed = proto_tree_add_protocol_format(meta_tree,
+ malformed = proto_tree_add_protocol_format(meta_tree,
proto_malformed, tvb, offs, -1, "[Malformed Packet: %s]", pinfo->current_proto);
expert_add_info_format(pinfo, malformed, PI_MALFORMED, PI_ERROR,
"Malformed Packet (wrong item encoding)");
@@ -515,7 +515,7 @@ proto_register_meta(void)
{ &hf_meta_reserved, { "Reserved", "meta.reserved", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } },
/* general meta item */
- { &hf_meta_item, { "Unknown Item", "meta.item", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } },
+ { &hf_meta_item, { "Unknown Item", "meta.item", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL } },
{ &hf_meta_item_id, { "Item ID", "meta.item.id", FT_UINT16, BASE_HEX, VALS(meta_id_vals), 0x0, NULL, HFILL } },
{ &hf_meta_item_type, { "Item Type", "meta.item.type", FT_UINT8, BASE_HEX, VALS(meta_type_vals), 0x0, NULL, HFILL } },
{ &hf_meta_item_len, { "Item Length", "meta.item.len", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c
index 10b45617d3..99687c8517 100644
--- a/epan/dissectors/packet-mmse.c
+++ b/epan/dissectors/packet-mmse.c
@@ -1287,8 +1287,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
proto_tree_add_string_format(mmse_tree,
hf_mmse_ffheader, tvb, offset,
length + length2,
- (const char *) tvb_get_ptr(
- tvb, offset, length + length2),
+ tvb_get_ephemeral_string(tvb, offset,
+ length + length2),
"%s: %s",
format_text(strval, strlen(strval)),
format_text(strval2, strlen(strval2)));
diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c
index f5fadfb55f..2414d02fc6 100644
--- a/epan/dissectors/packet-mount.c
+++ b/epan/dissectors/packet-mount.c
@@ -169,28 +169,24 @@ dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
if(civ->request && (civ->proc==1)){
const gchar *host;
unsigned char *name;
- unsigned const char *dir;
int len;
+ unsigned char *ptr;
host=ip_to_str(pinfo->dst.data);
len=tvb_get_ntohl(tvb, offset);
if (len >= ITEM_LABEL_LENGTH)
THROW(ReportedBoundsError);
- dir=tvb_get_ptr(tvb, offset+4, len);
- if(dir){
- unsigned char *ptr;
- name=g_malloc(strlen(host)+1+len+1+200);
- ptr=name;
- memcpy(ptr, host, strlen(host));
- ptr+=strlen(host);
- *ptr++=':';
- memcpy(ptr, dir, len);
- ptr+=len;
- *ptr=0;
-
- nfs_name_snoop_add_name(civ->xid, tvb, -1, (gint)strlen(name), 0, 0, name);
- }
+ name=g_malloc(strlen(host)+1+len+1+200);
+ ptr=name;
+ memcpy(ptr, host, strlen(host));
+ ptr+=strlen(host);
+ *ptr++=':';
+ tvb_memcpy(tvb, ptr, offset+4, len);
+ ptr+=len;
+ *ptr=0;
+
+ nfs_name_snoop_add_name(civ->xid, tvb, -1, (gint)strlen(name), 0, 0, name);
}
}
diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c
index 5c4f4e1df1..bfbe8d2435 100644
--- a/epan/dissectors/packet-msproxy.c
+++ b/epan/dissectors/packet-msproxy.c
@@ -304,7 +304,7 @@ static int display_application_name(tvbuff_t *tvb, int offset,
length = tvb_strnlen( tvb, offset, 255);
proto_tree_add_text( tree, tvb, offset, length, "Application: %.*s",
- length, tvb_get_ptr( tvb, offset, length));
+ length, tvb_get_ephemeral_string( tvb, offset, length));
return length;
}
@@ -367,7 +367,7 @@ static void dissect_user_info_2(tvbuff_t *tvb, int offset,
return;
proto_tree_add_text( tree, tvb, offset, length + 1,
"User name: %.*s", length,
- tvb_get_ptr( tvb, offset, length));
+ tvb_get_ephemeral_string( tvb, offset, length));
offset += length + 2;
length = tvb_strnlen( tvb, offset, 255);
@@ -375,7 +375,7 @@ static void dissect_user_info_2(tvbuff_t *tvb, int offset,
return;
proto_tree_add_text( tree, tvb, offset, length + 1,
"Application name: %.*s", length,
- tvb_get_ptr( tvb, offset, length));
+ tvb_get_ephemeral_string( tvb, offset, length));
offset += length + 1;
length = tvb_strnlen( tvb, offset, 255);
@@ -383,7 +383,7 @@ static void dissect_user_info_2(tvbuff_t *tvb, int offset,
return;
proto_tree_add_text( tree, tvb, offset, length + 1,
"Client computer name: %.*s", length,
- tvb_get_ptr( tvb, offset, length));
+ tvb_get_ephemeral_string( tvb, offset, length));
}
}
@@ -448,7 +448,7 @@ static void dissect_auth(tvbuff_t *tvb, int offset,
offset += 134;
proto_tree_add_text( tree, tvb, offset, 7, "NTLMSSP signature: %.7s",
- tvb_get_ptr( tvb, offset, 7));
+ tvb_get_ephemeral_string( tvb, offset, 7));
offset += 7;
}
}
@@ -571,7 +571,7 @@ static void dissect_request_resolve(tvbuff_t *tvb, int offset,
if ( tree){
ti = proto_tree_add_text(tree, tvb, offset, length + 1,
"Host Name: %.*s", length,
- tvb_get_ptr( tvb, offset + 18, length));
+ tvb_get_ephemeral_string( tvb, offset + 18, length));
name_tree = proto_item_add_subtree(ti, ett_msproxy_name);
@@ -582,7 +582,7 @@ static void dissect_request_resolve(tvbuff_t *tvb, int offset,
offset += 17;
proto_tree_add_text( name_tree, tvb, offset, length, "String: %s",
- tvb_get_ptr( tvb, offset, length));
+ tvb_get_ephemeral_string( tvb, offset, length));
}
}
@@ -672,7 +672,7 @@ static void dissect_msproxy_request(tvbuff_t *tvb,
offset += 8;
proto_tree_add_text( tree, tvb, offset, 4, "RWSP signature: %.4s",
- tvb_get_ptr( tvb, offset, 4));
+ tvb_get_ephemeral_string( tvb, offset, 4));
offset += 12;
}
else /* no tree */
@@ -799,12 +799,12 @@ static void dissect_auth_1_ack(tvbuff_t *tvb, int offset,
offset += 134;
if ( tree) {
proto_tree_add_text( tree, tvb, offset, 7, "NTLMSSP signature: %.7s",
- tvb_get_ptr( tvb, offset, 7));
+ tvb_get_ephemeral_string( tvb, offset, 7));
offset += 48;
/* XXX - always 255? */
proto_tree_add_text( tree, tvb, offset, 255, "NT domain: %.255s",
- tvb_get_ptr( tvb, offset, 255));
+ tvb_get_ephemeral_string( tvb, offset, 255));
}
}
@@ -993,7 +993,7 @@ static void dissect_msproxy_response(tvbuff_t *tvb, packet_info *pinfo,
offset += 8;
proto_tree_add_text( tree, tvb, offset, 4, "RWSP signature: %.4s",
- tvb_get_ptr( tvb, offset, 4));
+ tvb_get_ephemeral_string( tvb, offset, 4));
offset += 12;
}
diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c
index 524e0bfce1..0e99d4392d 100644
--- a/epan/dissectors/packet-mysql.c
+++ b/epan/dissectors/packet-mysql.c
@@ -1313,7 +1313,7 @@ mysql_dissect_greeting(tvbuff_t *tvb, packet_info *pinfo, int offset,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, " version=%s",
- tvb_get_ptr(tvb, offset, strlen));
+ tvb_get_ephemeral_string(tvb, offset, strlen));
}
proto_tree_add_item(greeting_tree, hf_mysql_version, tvb,
offset, strlen, FALSE );
@@ -1410,7 +1410,7 @@ mysql_dissect_login(tvbuff_t *tvb, packet_info *pinfo, int offset,
strlen= my_tvb_strsize(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, " user=%s",
- tvb_get_ptr(tvb,offset,strlen));
+ tvb_get_ephemeral_string(tvb,offset,strlen));
}
proto_tree_add_item(login_tree, hf_mysql_user, tvb,
offset, strlen, FALSE );
diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c
index c793990785..600f082da6 100644
--- a/epan/dissectors/packet-netbios.c
+++ b/epan/dissectors/packet-netbios.c
@@ -683,7 +683,7 @@ dissect_netb_datagram( tvbuff_t *tvb, int offset, proto_tree *tree)
/* Weird. In some datagrams, this is 10 octets of 0, followed
by a MAC address.... */
- if (memcmp( tvb_get_ptr( tvb,offset + NB_SENDER_NAME, 10), zeroes, 10) == 0) {
+ if (tvb_memeql(tvb, offset + NB_SENDER_NAME, zeroes, 10) == 0) {
proto_tree_add_text( tree, tvb, offset + NB_SENDER_NAME + 10, 6,
"Sender's MAC Address: %s",
ether_to_str( tvb_get_ptr( tvb,offset + NB_SENDER_NAME + 10, 6)));
@@ -702,7 +702,7 @@ dissect_netb_datagram_bcast( tvbuff_t *tvb, int offset, proto_tree *tree)
{/* Handle the DATAGRAM BROADCAST command */
/* We assume the same weirdness can happen here.... */
- if ( memcmp( tvb_get_ptr( tvb,offset + NB_SENDER_NAME + 10, 6), zeroes, 10) == 0) {
+ if (tvb_memeql(tvb, offset + NB_SENDER_NAME, zeroes, 10) == 0) {
proto_tree_add_text( tree, tvb, offset + NB_SENDER_NAME + 10, 6,
"Sender's Node Address: %s",
ether_to_str( tvb_get_ptr( tvb,offset + NB_SENDER_NAME + 10, 6)));
@@ -1141,7 +1141,7 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
default:
- col_add_str( pinfo->cinfo, COL_INFO,
+ col_add_str( pinfo->cinfo, COL_INFO,
command_name);
break;
}
diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c
index 59ed21abd5..bbcc4dc67d 100644
--- a/epan/dissectors/packet-ntp.c
+++ b/epan/dissectors/packet-ntp.c
@@ -699,7 +699,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
ppoll = tvb_get_guint8(tvb, 2);
if ((ppoll >= 4) && (ppoll <= 17)) {
proto_tree_add_uint_format(ntp_tree, hf_ntp_ppoll, tvb, 2, 1,
- ppoll,
+ ppoll,
"Peer Polling Interval: %u (%u sec)",
ppoll,
1 << ppoll);
@@ -709,7 +709,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
"Peer Polling Interval: invalid (%u)",
ppoll);
}
-
+
/* Precision, 1byte field indicating the precision of the
* local clock, in seconds to the nearest power of two.
*/
@@ -752,9 +752,9 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
buff = ep_alloc(NTP_TS_SIZE);
if (stratum <= 1) {
g_snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%.4s'",
- refid);
+ tvb_get_ephemeral_string(tvb, 12, 4));
for (i = 0; primary_sources[i].id; i++) {
- if (memcmp (refid, primary_sources[i].id, 4) == 0) {
+ if (tvb_memeql(tvb, 12, primary_sources[i].id, 4)) {
g_snprintf(buff, NTP_TS_SIZE, "%s",
primary_sources[i].data);
break;
diff --git a/epan/dissectors/packet-pagp.c b/epan/dissectors/packet-pagp.c
index 07e5307e6d..1f6cd7c47b 100644
--- a/epan/dissectors/packet-pagp.c
+++ b/epan/dissectors/packet-pagp.c
@@ -175,8 +175,6 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
struct _address device_id;
- const guint8 *p_sys;
-
guchar *ch;
proto_tree *pagp_tree = NULL;
@@ -390,9 +388,8 @@ dissect_pagp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset+4, len-4, ch);
break;
case PAGP_TLV_AGPORT_MAC:
- p_sys = tvb_get_ptr(tvb, offset+4, 6);
- proto_tree_add_ether(tlv_tree, hf_pagp_tlv_agport_mac,
- tvb, offset+4, 6, p_sys);
+ proto_tree_add_item(tlv_tree, hf_pagp_tlv_agport_mac,
+ tvb, offset+4, 6, ENC_NA);
break;
case PAGP_TLV_RESERVED:
break;
diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c
index 3022bafbaf..e10b8f4f57 100644
--- a/epan/dissectors/packet-pktc.c
+++ b/epan/dissectors/packet-pktc.c
@@ -504,7 +504,7 @@ dissect_pktc_mtafqdn_krbsafeuserdata(packet_info *pinfo, tvbuff_t *tvb, proto_tr
switch(msgtype) {
case PKTC_MTAFQDN_REQ:
/* MTA MAC address */
- proto_tree_add_ether(tree, hf_pktc_mtafqdn_mac, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6));
+ proto_tree_add_item(tree, hf_pktc_mtafqdn_mac, tvb, offset, 6, ENC_NA);
offset+=6;
/* MTA pub key hash */
diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c
index f82b547bb9..382fbcf5e4 100644
--- a/epan/dissectors/packet-q2931.c
+++ b/epan/dissectors/packet-q2931.c
@@ -1293,7 +1293,7 @@ dissect_q2931_cause_ie(tvbuff_t *tvb, int offset, int len,
if (len < 3)
return;
proto_tree_add_text(tree, tvb, offset, 3,
- "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
+ "Timer: %.3s", tvb_get_ephemeral_string(tvb, offset, 3));
break;
default:
@@ -1428,7 +1428,7 @@ dissect_q2931_number_ie(tvbuff_t *tvb, int offset, int len,
case Q2931_ISDN_NUMBERING:
proto_tree_add_text(tree, tvb, offset, len, "Number: %.*s",
- len, tvb_get_ptr(tvb, offset, len));
+ len, tvb_get_ephemeral_string(tvb, offset, len));
break;
case Q2931_NSAP_ADDRESSING:
@@ -1732,7 +1732,7 @@ dissect_q2931_transit_network_sel_ie(tvbuff_t *tvb, int offset, int len,
if (len == 0)
return;
proto_tree_add_text(tree, tvb, offset, len,
- "Network identification: %.*s", len, tvb_get_ptr(tvb, offset, len));
+ "Network identification: %.*s", len, tvb_get_ephemeral_string(tvb, offset, len));
}
/*
diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c
index 9c98dafa8c..bf6e3a32e4 100644
--- a/epan/dissectors/packet-q931.c
+++ b/epan/dissectors/packet-q931.c
@@ -1398,7 +1398,7 @@ dissect_q931_cause_ie_unsafe(tvbuff_t *tvb, int offset, int len,
if (len < 3)
return;
proto_tree_add_text(tree, tvb, offset, 3,
- "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
+ "Timer: %.3s", tvb_get_ephemeral_string(tvb, offset, 3));
break;
default:
diff --git a/epan/dissectors/packet-q933.c b/epan/dissectors/packet-q933.c
index 2ac96e2447..8255be41f4 100644
--- a/epan/dissectors/packet-q933.c
+++ b/epan/dissectors/packet-q933.c
@@ -1028,7 +1028,7 @@ dissect_q933_cause_ie(tvbuff_t *tvb, int offset, int len,
if (len < 3)
return;
proto_tree_add_text(tree, tvb, offset, 3,
- "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
+ "Timer: %.3s", tvb_get_ephemeral_string(tvb, offset, 3));
break;
default:
@@ -1648,7 +1648,7 @@ dissect_q933_number_ie(tvbuff_t *tvb, int offset, int len,
proto_tree_add_uint(tree, hf_q933_numbering_plan, tvb, offset, 1, octet);
proto_tree_add_uint(tree, hf_q933_number_type, tvb, offset, 1, octet);
proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
-
+
offset += 1;
len -= 1;
diff --git a/epan/dissectors/packet-quake2.c b/epan/dissectors/packet-quake2.c
index c930c74146..468b40e15d 100644
--- a/epan/dissectors/packet-quake2.c
+++ b/epan/dissectors/packet-quake2.c
@@ -347,7 +347,7 @@ dissect_quake2_client_commands_uinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
if (tree) {
userinfo_item = proto_tree_add_text(tree, tvb, 0, len, "Userinfo: %s",
- tvb_get_ptr(tvb, 0, len));
+ tvb_get_ephemeral_string(tvb, 0, len));
}
return len;
@@ -364,7 +364,7 @@ dissect_quake2_client_commands_stringcmd(tvbuff_t *tvb, packet_info *pinfo _U_,
if (tree) {
stringcmd_item = proto_tree_add_text(tree, tvb, 0, len, "Command: %s",
- tvb_get_ptr(tvb, 0, len));
+ tvb_get_ephemeral_string(tvb, 0, len));
}
return len;
diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c
index 200d26202a..4d45601847 100644
--- a/epan/dissectors/packet-raw.c
+++ b/epan/dissectors/packet-raw.c
@@ -152,7 +152,7 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* ...and if the connection is currently down, it sends 10 bytes of zeroes
* instead of a fake MAC address and PPP header. */
- else if (memcmp(tvb_get_ptr(tvb, 0, 10), zeroes, 10) == 0) {
+ else if (tvb_memeql(tvb, 0, zeroes,10) == 0) {
next_tvb = tvb_new_subset_remaining(tvb, 10);
call_dissector(ip_handle, next_tvb, pinfo, tree);
}
diff --git a/epan/dissectors/packet-rmt-lct.c b/epan/dissectors/packet-rmt-lct.c
index 16b7f31349..931e53f944 100644
--- a/epan/dissectors/packet-rmt-lct.c
+++ b/epan/dissectors/packet-rmt-lct.c
@@ -340,9 +340,8 @@ gboolean lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, prot
/* Congestion Control Information (CCI) */
if (l.lct->cci_size > 0) {
- l.lct->cci = (guint8*) tvb_get_ptr(tvb, *offset, l.lct->cci_size);
if (tree)
- proto_tree_add_bytes(lct_tree, l.hf->cci, tvb, *offset, l.lct->cci_size, l.lct->cci);
+ proto_tree_add_item(lct_tree, l.hf->cci, tvb, *offset, l.lct->cci_size, ENC_NA);
*offset += l.lct->cci_size;
}
diff --git a/epan/dissectors/packet-rmt-lct.h b/epan/dissectors/packet-rmt-lct.h
index 00900387e9..de25b08101 100644
--- a/epan/dissectors/packet-rmt-lct.h
+++ b/epan/dissectors/packet-rmt-lct.h
@@ -48,7 +48,6 @@ struct _lct
gboolean close_object;
guint16 hlen;
guint8 codepoint;
- guint8 *cci;
guint64 tsi;
guint64 toi;
const guint8 *toi_extended;
diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c
index 51f69204ce..3019f949b7 100644
--- a/epan/dissectors/packet-sap.c
+++ b/epan/dissectors/packet-sap.c
@@ -122,7 +122,6 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 vers_flags;
guint8 auth_len;
guint16 tmp1;
- const guint8 *addr;
guint8 auth_flags;
tvbuff_t *next_tvb;
@@ -168,9 +167,8 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(sap_tree, tvb, offset, 2, "Message Identifier Hash: 0x%x", tmp1);
offset +=2;
- addr = tvb_get_ptr(tvb, offset, addr_len);
proto_tree_add_text(sap_tree, tvb, offset, addr_len, "Originating Source: %s",
- (is_ipv6) ? ip6_to_str((const struct e_in6_addr*)addr) : ip_to_str(addr));
+ (is_ipv6) ? tvb_ip6_to_str(tvb, offset) : tvb_ip_to_str(tvb, offset));
offset += addr_len;
/* Authentication data lives in its own subtree */
@@ -264,7 +262,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
proto_tree_add_text(sap_tree, tvb, offset, pt_len,
"Payload type: %.*s", pt_string_len,
- tvb_get_ptr(tvb, offset, pt_string_len));
+ tvb_get_ephemeral_string(tvb, offset, pt_string_len));
offset += pt_len;
}
}
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index abac8a0911..3145d70e27 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -326,7 +326,7 @@ static GHashTable *scsi_fragment_table = NULL;
static GHashTable *scsi_reassembled_table = NULL;
/*
- * Required by all commands
+ * Required by all commands
*/
const int *cdb_control_fields[6] = {
&hf_scsi_control_vendor_specific,
@@ -1429,7 +1429,7 @@ static const true_false_string scsi_all_tg_pt_tfs = {
static const true_false_string scsi_aptpl_tfs = {
"Active Persist Through Power Loss is set",
- "Active Persist Through Power Loss is not set"
+ "Active Persist Through Power Loss is not set"
};
static const true_false_string scsi_naca_tfs = {
@@ -3966,10 +3966,10 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
cdata->itlq->flags = tvb_get_guint8 (tvb, offset);
}
else if (isreq && !iscdb) {
- proto_tree_add_bytes (tree, hf_scsi_persresvout_reskey, tvb, offset,
- 8, tvb_get_ptr(tvb, 0, 8));
- proto_tree_add_bytes (tree, hf_scsi_persresvout_sareskey, tvb,
- offset +8, 8, tvb_get_ptr(tvb, offset + 8, 8));
+ proto_tree_add_item (tree, hf_scsi_persresvout_reskey, tvb, offset,
+ 8, ENC_NA);
+ proto_tree_add_item (tree, hf_scsi_persresvout_sareskey, tvb,
+ offset +8, 8, ENC_NA);
if (cdata->itlq->flags == 0x07) {
const int *persresv_fields[] = {
&hf_scsi_persresv_control_rsvd,
@@ -3977,9 +3977,9 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
&hf_scsi_persresv_control_aptpl,
NULL
};
- proto_tree_add_bytes (tree, hf_scsi_persresvout_obsolete, tvb,
- offset+16, 1, tvb_get_ptr(tvb, offset+16, 1));
- proto_tree_add_bitmask(tree, tvb, offset+17,
+ proto_tree_add_item (tree, hf_scsi_persresvout_obsolete, tvb,
+ offset+16, 1, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, offset+17,
hf_scsi_persresvout_control, ett_persresv_control,
persresv_fields, FALSE);
}
@@ -3993,9 +3993,9 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
NULL
};
- proto_tree_add_bytes (tree, hf_scsi_persresvout_obsolete, tvb,
- offset+16, 4, tvb_get_ptr(tvb, offset+16, 4));
- proto_tree_add_bitmask(tree, tvb, offset+20,
+ proto_tree_add_item (tree, hf_scsi_persresvout_obsolete, tvb,
+ offset+16, 4, ENC_NA);
+ proto_tree_add_bitmask(tree, tvb, offset+20,
hf_scsi_persresvout_control, ett_persresv_control,
persresv_fields, FALSE);
}
@@ -5019,7 +5019,7 @@ proto_register_scsi (void)
{"Reserved", "scsi.cdb.control.reserved", FT_UINT8, BASE_HEX, NULL,
0x38, NULL, HFILL}},
{ &hf_scsi_control_naca,
- {"NACA", "scsi.cdb.control.naca", FT_BOOLEAN, 8,
+ {"NACA", "scsi.cdb.control.naca", FT_BOOLEAN, 8,
TFS(&scsi_naca_tfs), 0x04, NULL, HFILL}},
{ &hf_scsi_control_obs1,
{"Obsolete", "scsi.cdb.control.obs1", FT_UINT8, BASE_HEX,
@@ -5028,7 +5028,7 @@ proto_register_scsi (void)
{"Obsolete", "scsi.cdb.control.obs2", FT_UINT8, BASE_HEX,
NULL, 0x01, NULL, HFILL}},
{ &hf_scsi_inq_control,
- {"Control", "scsi.cdb.inq.control", FT_UINT8, BASE_HEX, NULL, 0x0,
+ {"Control", "scsi.cdb.inq.control", FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_scsi_inquiry_flags,
{"Inquiry Flags", "scsi.inquiry.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL,
@@ -5226,7 +5226,7 @@ proto_register_scsi (void)
{"Reserved", "scsi.inquiry.control.reserved", FT_UINT8, BASE_HEX,
NULL, 0x38, NULL, HFILL}},
{ &hf_scsi_inq_control_naca,
- {"NACA", "scsi.inquiry.control.naca", FT_BOOLEAN, 8,
+ {"NACA", "scsi.inquiry.control.naca", FT_BOOLEAN, 8,
TFS(&scsi_naca_tfs), 0x04, NULL, HFILL}},
{ &hf_scsi_inq_control_obs1,
{"Obsolete", "scsi.inquiry.control.obs1", FT_UINT8, BASE_HEX,
diff --git a/epan/dissectors/packet-slowprotocols.c b/epan/dissectors/packet-slowprotocols.c
index b961a5a314..d178fe8cae 100644
--- a/epan/dissectors/packet-slowprotocols.c
+++ b/epan/dissectors/packet-slowprotocols.c
@@ -1113,9 +1113,7 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 flags;
- const guint8 *a_sys;
const guint8 *p_sys;
- const guint8 *resv_bytes;
proto_tree *lacpdu_tree;
proto_item *lacpdu_item;
@@ -1165,9 +1163,8 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
LACPDU_ACTOR_SYS_PRIORITY, 2, raw_word);
/* Actor System */
- a_sys = tvb_get_ptr(tvb, LACPDU_ACTOR_SYSTEM , 6);
- proto_tree_add_ether(lacpdu_tree, hf_lacpdu_actor_sys, tvb,
- LACPDU_ACTOR_SYSTEM, 6, a_sys);
+ proto_tree_add_item(lacpdu_tree, hf_lacpdu_actor_sys, tvb,
+ LACPDU_ACTOR_SYSTEM, 6, ENC_NA);
/* Actor Key */
@@ -1263,9 +1260,8 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Actor Reserved */
- resv_bytes = tvb_get_ptr(tvb, LACPDU_ACTOR_RESERVED, 3);
- proto_tree_add_bytes(lacpdu_tree, hf_lacpdu_actor_reserved, tvb,
- LACPDU_ACTOR_RESERVED, 3, resv_bytes);
+ proto_tree_add_item(lacpdu_tree, hf_lacpdu_actor_reserved, tvb,
+ LACPDU_ACTOR_RESERVED, 3, ENC_NA);
/* Partner Type */
@@ -1384,9 +1380,8 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Partner Reserved */
- resv_bytes = tvb_get_ptr(tvb, LACPDU_PARTNER_RESERVED, 3);
- proto_tree_add_bytes(lacpdu_tree, hf_lacpdu_partner_reserved, tvb,
- LACPDU_PARTNER_RESERVED, 3, resv_bytes);
+ proto_tree_add_item(lacpdu_tree, hf_lacpdu_partner_reserved, tvb,
+ LACPDU_PARTNER_RESERVED, 3, ENC_NA);
/* Collector Type */
@@ -1407,9 +1402,8 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Collector Reserved */
- resv_bytes = tvb_get_ptr(tvb, LACPDU_COLL_RESERVED, 12);
proto_tree_add_bytes(lacpdu_tree, hf_lacpdu_coll_reserved, tvb,
- LACPDU_COLL_RESERVED, 12, resv_bytes);
+ LACPDU_COLL_RESERVED, 12, ENC_NA);
/* Terminator Type */
raw_octet = tvb_get_guint8(tvb, LACPDU_TERM_TYPE);
@@ -1423,9 +1417,8 @@ dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Terminator Reserved */
- resv_bytes = tvb_get_ptr(tvb, LACPDU_TERM_RESERVED, 50);
- proto_tree_add_bytes(lacpdu_tree, hf_lacpdu_term_reserved, tvb,
- LACPDU_TERM_RESERVED, 50, resv_bytes);
+ proto_tree_add_item(lacpdu_tree, hf_lacpdu_term_reserved, tvb,
+ LACPDU_TERM_RESERVED, 50, ENC_NA);
}
}
@@ -1457,8 +1450,6 @@ dissect_marker_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 dword;
guint32 offset;
- const guint8 *a_sys;
-
proto_tree *marker_tree;
proto_item *marker_item;
@@ -1510,9 +1501,8 @@ dissect_marker_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 2;
/* Requester System */
- a_sys = tvb_get_ptr(tvb, offset , 6);
- proto_tree_add_ether(marker_tree, hf_marker_req_system, tvb,
- offset, 6, a_sys);
+ proto_tree_add_item(marker_tree, hf_marker_req_system, tvb,
+ offset, 6, ENC_NA);
offset += 6;
/* Requester Transaction ID */
@@ -2123,7 +2113,6 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
guint32 offset;
guint16 bytes;
- const guint8 *resv_bytes;
const guint8 *ptr;
proto_tree *info_tree;
@@ -2241,17 +2230,15 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
offset += OAMPDU_INFO_OAMPDU_CONFIG_SZ;
- resv_bytes = tvb_get_ptr(tvb, offset, 3);
- oui_item = proto_tree_add_bytes(info_tree, hf_oampdu_info_oui,
- tvb, offset, 3, resv_bytes);
+ oui_item = proto_tree_add_item(info_tree, hf_oampdu_info_oui,
+ tvb, offset, 3, ENC_NA);
- APPEND_OUI_NAME(oui_item, ptr, resv_bytes);
+ APPEND_OUI_NAME(oui_item, ptr, tvb_get_ptr(tvb, offset, 3));
offset += OAMPDU_INFO_OUI_SZ;
- resv_bytes = tvb_get_ptr(tvb, offset, 4);
- proto_tree_add_bytes(info_tree, hf_oampdu_info_vendor,
- tvb, offset, 4, resv_bytes);
+ proto_tree_add_item(info_tree, hf_oampdu_info_vendor,
+ tvb, offset, 4, ENC_NA);
offset += OAMPDU_INFO_VENDOR_SPECIFIC_SZ;
}
@@ -2264,17 +2251,15 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
offset += OAMPDU_INFO_LENGTH_SZ;
- resv_bytes = tvb_get_ptr(tvb, offset, 3);
- oui_item = proto_tree_add_bytes(info_tree, hf_oampdu_info_oui,
- tvb, offset, 3, resv_bytes);
+ oui_item = proto_tree_add_item(info_tree, hf_oampdu_info_oui,
+ tvb, offset, 3, ENC_NA);
- APPEND_OUI_NAME(oui_item, ptr, resv_bytes);
+ APPEND_OUI_NAME(oui_item, ptr, tvb_get_ptr(tvb, offset, 3));
offset += OAMPDU_INFO_OUI_SZ;
- resv_bytes = tvb_get_ptr(tvb, offset, raw_octet-5);
- proto_tree_add_bytes(info_tree, hf_oampdu_info_vendor,
- tvb, offset, raw_octet-5, resv_bytes);
+ proto_tree_add_item(info_tree, hf_oampdu_info_vendor,
+ tvb, offset, raw_octet-5, ENC_NA);
offset += raw_octet-2;
@@ -2670,8 +2655,6 @@ dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
guint8 raw_octet;
guint32 offset;
- const guint8 *resv_bytes;
-
offset = OAMPDU_HEADER_SIZE;
@@ -2742,9 +2725,8 @@ dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
offset+=1;
- resv_bytes = tvb_get_ptr(tvb, offset, raw_octet);
- proto_tree_add_bytes(tree, hf_oampdu_variable_value,
- tvb, offset, raw_octet, resv_bytes);
+ proto_tree_add_item(tree, hf_oampdu_variable_value,
+ tvb, offset, raw_octet, ENC_NA);
offset+=raw_octet;
}
@@ -2835,7 +2817,6 @@ dissect_oampdu_vendor_specific(tvbuff_t *tvb, proto_tree *tree)
guint32 offset;
guint16 bytes;
- const guint8 *resv_bytes;
const guint8 *ptr;
proto_item *oui_item;
@@ -2847,11 +2828,10 @@ dissect_oampdu_vendor_specific(tvbuff_t *tvb, proto_tree *tree)
if (bytes >= 3)
{
- resv_bytes = tvb_get_ptr(tvb, offset, 3);
- oui_item = proto_tree_add_bytes(tree, hf_oampdu_info_oui,
- tvb, offset, 3, resv_bytes);
+ oui_item = proto_tree_add_item(tree, hf_oampdu_info_oui,
+ tvb, offset, 3, ENC_NA);
- APPEND_OUI_NAME(oui_item, ptr, resv_bytes);
+ APPEND_OUI_NAME(oui_item, ptr, tvb_get_ptr(tvb, offset, 3));
}
}
diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c
index 82a54fc52f..e8042f15f3 100644
--- a/epan/dissectors/packet-smb-browse.c
+++ b/epan/dissectors/packet-smb-browse.c
@@ -909,8 +909,7 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr
offset += 2;
/* server name */
- namelen = tvb_strsize(tvb, offset);
- host_name = tvb_get_ptr(tvb, offset, namelen);
+ host_name = tvb_get_const_stringz(tvb, offset, &namelen);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", host_name);
}
diff --git a/epan/dissectors/packet-smb-common.c b/epan/dissectors/packet-smb-common.c
index ac823bbfa2..501a660657 100644
--- a/epan/dissectors/packet-smb-common.c
+++ b/epan/dissectors/packet-smb-common.c
@@ -352,8 +352,7 @@ get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp,
string_len = *len;
string = cur;
} else {
- string_len = tvb_strsize(tvb, *offsetp);
- string = tvb_get_ptr(tvb, *offsetp, string_len);
+ string = tvb_get_const_stringz(tvb, *offsetp, &string_len);
}
}
diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c
index 350adecc4c..bf458a0088 100644
--- a/epan/dissectors/packet-smb-pipe.c
+++ b/epan/dissectors/packet-smb-pipe.c
@@ -799,7 +799,7 @@ netshareenum_share_entry(tvbuff_t *tvb, proto_tree *tree, int offset)
{
if (tree) {
return proto_tree_add_text(tree, tvb, offset, -1,
- "Share %.13s", tvb_get_ptr(tvb, offset, 13));
+ "Share %.13s", tvb_get_ephemeral_string(tvb, offset, 13));
} else
return NULL;
}
@@ -999,7 +999,7 @@ netserverenum2_server_entry(tvbuff_t *tvb, proto_tree *tree, int offset)
{
if (tree) {
return proto_tree_add_text(tree, tvb, offset, -1,
- "Server %.16s", tvb_get_ptr(tvb, offset, 16));
+ "Server %.16s", tvb_get_ephemeral_string(tvb, offset, 16));
} else
return NULL;
}
@@ -2690,10 +2690,9 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb,
}
/* parameter descriptor */
- descriptor_len = tvb_strsize(p_tvb, offset);
+ param_descrip = tvb_get_const_stringz(p_tvb, offset, &descriptor_len);
proto_tree_add_item(tree, hf_param_desc, p_tvb, offset,
descriptor_len, TRUE);
- param_descrip = tvb_get_ptr(p_tvb, offset, descriptor_len);
if (!pinfo->fd->flags.visited) {
/*
* Save the parameter descriptor for future use.
@@ -2704,10 +2703,9 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb,
offset += descriptor_len;
/* return descriptor */
- descriptor_len = tvb_strsize(p_tvb, offset);
+ data_descrip = tvb_get_const_stringz(p_tvb, offset, &descriptor_len);
proto_tree_add_item(tree, hf_return_desc, p_tvb, offset,
descriptor_len, TRUE);
- data_descrip = tvb_get_ptr(p_tvb, offset, descriptor_len);
if (!pinfo->fd->flags.visited) {
/*
* Save the return descriptor for future use.
@@ -2730,10 +2728,9 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb,
* There are more parameters left, so the next
* item is the auxiliary data descriptor.
*/
- descriptor_len = tvb_strsize(p_tvb, offset);
+ aux_data_descrip = tvb_get_const_stringz(p_tvb, offset, &descriptor_len);
proto_tree_add_item(tree, hf_aux_data_desc, p_tvb, offset,
descriptor_len, TRUE);
- aux_data_descrip = tvb_get_ptr(p_tvb, offset, descriptor_len);
if (!pinfo->fd->flags.visited) {
/*
* Save the auxiliary data descriptor for
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index 14472a324b..2f1c25bb74 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -2139,8 +2139,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
/* XXX - what if this runs past bc? */
tvb_ensure_bytes_exist(tvb, offset+1, 1);
- len = tvb_strsize(tvb, offset+1);
- str = tvb_get_ptr(tvb, offset+1, len);
+ str = tvb_get_const_stringz(tvb, offset+1, &len);
if(tr){
dit = proto_tree_add_text(tr, tvb, offset, len+1,
diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c
index 3f68f04df2..e30f1e02d7 100644
--- a/epan/dissectors/packet-smpp.c
+++ b/epan/dissectors/packet-smpp.c
@@ -1111,8 +1111,7 @@ smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
len = tvb_strsize(tvb, *offset);
if (len > 1) {
- proto_tree_add_string(tree, field, tvb, *offset, len,
- (const char *) tvb_get_ptr(tvb, *offset, len));
+ proto_tree_add_item(tree, field, tvb, *offset, len, ENC_NA);
}
(*offset) += len;
}
@@ -1143,8 +1142,7 @@ smpp_handle_string_z(proto_tree *tree, tvbuff_t *tvb, int field, int *offset,
len = tvb_strsize(tvb, *offset);
if (len > 1) {
- proto_tree_add_string(tree, field, tvb, *offset, len,
- (const char *)tvb_get_ptr(tvb, *offset, len));
+ proto_tree_add_item(tree, field, tvb, *offset, len, ENC_NA);
} else {
proto_tree_add_string(tree, field, tvb, *offset, len, null_string);
}
@@ -1321,9 +1319,9 @@ smpp_handle_tlv(proto_tree *tree, tvbuff_t *tvb, int *offset)
proto_item_add_subtree(sub_tree, ett_opt_param);
proto_tree_add_uint(sub_tree,hf_smpp_opt_param_tag,tvb,*offset,2,tag);
proto_tree_add_uint(sub_tree,hf_smpp_opt_param_len,tvb,*offset+2,2,length);
-
+
*offset += 4;
-
+
switch (tag) {
case 0x0005: /* dest_addr_subunit */
smpp_handle_int1(sub_tree, tvb,
@@ -3536,6 +3534,6 @@ proto_reg_handoff_smpp(void)
/* Tapping setup */
stats_tree_register_with_group("smpp","smpp_commands", "SM_PP Operations", 0,
- smpp_stats_tree_per_packet, smpp_stats_tree_init,
+ smpp_stats_tree_per_packet, smpp_stats_tree_init,
NULL, REGISTER_STAT_GROUP_TELEPHONY);
}
diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c
index 79beed2974..5ac8fa928e 100644
--- a/epan/dissectors/packet-socks.c
+++ b/epan/dissectors/packet-socks.c
@@ -546,7 +546,7 @@ display_socks_v4(tvbuff_t *tvb, int offset, packet_info *pinfo,
if ( tvb_offset_exists(tvb, offset)) {
proto_tree_add_text( tree, tvb, offset,
tvb_strsize(tvb, offset),
- "User Name: %s", tvb_get_ptr(tvb, offset, -1));
+ "User Name: %s", tvb_get_ephemeral_string(tvb, offset, -1));
}
}
}
diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c
index b18eb0f60e..349e3d7051 100644
--- a/epan/dissectors/packet-srvloc.c
+++ b/epan/dissectors/packet-srvloc.c
@@ -448,7 +448,7 @@ add_v1_string(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length,
static guint8*
unicode_to_bytes(tvbuff_t *tvb, int offset, int length, gboolean endianness)
{
- const guint8 *ascii_text = tvb_get_ptr(tvb, offset, length);
+ const guint8 *ascii_text = tvb_get_ephemeral_string(tvb, offset, length);
int i, j=0;
guint8 c_char, c_char1;
guint8 *byte_array;
@@ -632,7 +632,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length,
break;
case CHARSET_UTF_8:
- type_len = (int)strcspn(tvb_get_ptr(tvb, offset, length), "=");
+ type_len = (int)strcspn(tvb_get_ephemeral_string(tvb, offset, length), "=");
attr_type = unicode_to_bytes(tvb, offset+1, type_len-1, FALSE);
proto_tree_add_string(tree, hf, tvb, offset+1, type_len-1, attr_type);
i=1;
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index 0783a1523e..6c25167b24 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -2037,9 +2037,8 @@ dissect_ssl3_hnd_hello_common(tvbuff_t *tvb, proto_tree *tree,
if (session_id_length > 0)
{
tvb_ensure_bytes_exist(tvb, offset, session_id_length);
- proto_tree_add_bytes(tree, hf_ssl_handshake_session_id,
- tvb, offset, session_id_length,
- tvb_get_ptr(tvb, offset, session_id_length));
+ proto_tree_add_item(tree, hf_ssl_handshake_session_id,
+ tvb, offset, session_id_length, ENC_NA);
}
}
@@ -2563,7 +2562,7 @@ dissect_ssl3_hnd_cert_req(tvbuff_t *tvb,
{
subtree = tree;
}
-
+
if (sh_alg_length % 2) {
proto_tree_add_text(tree, tvb, offset, 2,
"Invalid Signature Hash Algorithm length: %d", sh_alg_length);
diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c
index 9ad5ca6f6e..a2ccd2cfc3 100644
--- a/epan/dissectors/packet-trmac.c
+++ b/epan/dissectors/packet-trmac.c
@@ -241,7 +241,7 @@ sv_text(tvbuff_t *tvb, int svoff, proto_tree *tree)
break;
case 0x2D: /* Isolating Error Counts */
- memcpy(errors, tvb_get_ptr(tvb, svoff+2, 6), 6);
+ tvb_memcpy(tvb, errors, svoff+2, 6);
ti = proto_tree_add_uint(tree, hf_trmac_errors_iso, tvb, svoff+1, sv_length-1,
errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
sv_tree = proto_item_add_subtree(ti, ett_tr_ierr_cnt);
@@ -255,7 +255,7 @@ sv_text(tvbuff_t *tvb, int svoff, proto_tree *tree)
break;
case 0x2E: /* Non-Isolating Error Counts */
- memcpy(errors, tvb_get_ptr(tvb, svoff+2, 6), 6);
+ tvb_memcpy(tvb, errors, svoff+2, 6);
ti = proto_tree_add_uint(tree, hf_trmac_errors_noniso, tvb, svoff+1, sv_length-1,
errors[0] + errors[1] + errors[2] + errors[3] + errors[4]);
sv_tree = proto_item_add_subtree(ti, ett_tr_nerr_cnt);
diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c
index 998a48dafa..bda3fed8b9 100644
--- a/epan/dissectors/packet-uma.c
+++ b/epan/dissectors/packet-uma.c
@@ -922,7 +922,6 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
guint8 octet;
proto_item *urr_ie_item;
proto_tree *urr_ie_tree;
- const guint8 *haddr;
char *string;
guint16 GPRS_user_data_transport_UDP_port,UNC_tcp_port,RTP_UDP_port,RTCP_UDP_port, communication_port;
guint32 udr;
@@ -972,8 +971,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
octet = tvb_get_guint8(tvb,ie_offset);
if (( octet & 0xf) == 0){ /* IEEE MAC-address format */
ie_offset++;
- haddr = tvb_get_ptr(tvb, ie_offset, ie_len);
- proto_tree_add_ether(urr_ie_tree, hf_uma_urr_radio_id, tvb, ie_offset, ie_len, haddr);
+ proto_tree_add_item(urr_ie_tree, hf_uma_urr_radio_id, tvb, ie_offset, ie_len, ENC_NA);
}else{
proto_tree_add_text(urr_ie_tree, tvb, ie_offset, ie_len,"Unknown format");
}
@@ -1052,7 +1050,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
de_rr_cell_dsc(tvb, urr_ie_tree, ie_offset, ie_len, NULL, 0);
break;
case 14:
- /*
+ /*
* 11.2.14 GAN Control Channel Description
*/
proto_tree_add_item(urr_ie_tree, hf_uma_urr_ECMC, tvb, ie_offset, 1, FALSE);
@@ -1124,8 +1122,8 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
proto_tree_add_item(urr_ie_tree, hf_uma_urr_communication_port, tvb, ie_offset, 2, FALSE);
break;
- case 26:
- /* 11.2.26 L3 Message
+ case 26:
+ /* 11.2.26 L3 Message
* The L3 Message information element contains the upper layer message to be transported
* using the GA-CSR protocol or the GA-RRC protocol between the MS and the core network.
*/
@@ -1179,7 +1177,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
if (!dissector_try_uint(bssap_pdu_type_table,BSSAP_PDU_TYPE_DTAP, l3_tvb, pinfo, urr_ie_tree))
call_dissector(data_handle, l3_tvb, pinfo, urr_ie_tree);
break;
- case 33:
+ case 33:
/* 11.2.33 UL Quality Indication */
proto_tree_add_item(urr_ie_tree, hf_uma_urr_ULQI, tvb, ie_offset, 1, FALSE);
break;
@@ -1359,7 +1357,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
/* XXX TODO: loop ower the octets */
/* Window Size (octet 3 to octet n) Bits 2 1 */
proto_tree_add_item(urr_ie_tree, hf_uma_urr_window_size, tvb, ie_offset, 1, FALSE);
- /* GAN A/Gb Mode Codec Mode (octet 3 to octet n) Bits 8 7
+ /* GAN A/Gb Mode Codec Mode (octet 3 to octet n) Bits 8 7
* The GAN A/Gb Mode Codec Mode is coded as in [47] sub-clause 3.4.1
*/
proto_tree_add_item(urr_ie_tree, hf_uma_urr_uma_codec_mode, tvb, ie_offset, 1, FALSE);
@@ -1480,8 +1478,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
octet = tvb_get_guint8(tvb,ie_offset);
if (( octet & 0xf) == 0){ /* IEEE MAC-address format */
ie_offset++;
- haddr = tvb_get_ptr(tvb, ie_offset, ie_len);
- proto_tree_add_ether(urr_ie_tree, hf_uma_urr_ms_radio_id, tvb, ie_offset, ie_len, haddr);
+ proto_tree_add_ether(urr_ie_tree, hf_uma_urr_ms_radio_id, tvb, ie_offset, ie_len, ENC_NA);
}else{
proto_tree_add_text(urr_ie_tree, tvb, ie_offset, ie_len,"Unknown format");
}
@@ -1502,7 +1499,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
proto_tree_add_ipv4(urr_ie_tree, hf_uma_urr_unc_ipv4, tvb, ie_offset, 4, unc_ipv4_address);
}
break;
- case 98:
+ case 98:
/* UNC Fully Qualified Domain/Host Name */
if ( ie_len > 0){
string = (gchar*)tvb_get_ephemeral_string(tvb, ie_offset, ie_len);
diff --git a/epan/dissectors/packet-vmlab.c b/epan/dissectors/packet-vmlab.c
index ce2e0a77a6..d75ee0d405 100644
--- a/epan/dissectors/packet-vmlab.c
+++ b/epan/dissectors/packet-vmlab.c
@@ -116,16 +116,16 @@ dissect_vmlab(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Not really clear, what the difference between this and the next MAC address is
Both are usually equal*/
eth_addr=tvb_get_ptr(tvb, offset, 6);
- proto_tree_add_ether(vmlab_tree, hf_vmlab_eth_addr, tvb, offset, 6, eth_addr);
+ proto_tree_add_item(vmlab_tree, hf_vmlab_eth_addr, tvb, offset, 6, ENC_NA);
offset += 6;
dst_addr=tvb_get_ptr(tvb, offset, 6);
- proto_tree_add_ether(vmlab_tree, hf_vmlab_eth_dst, tvb, offset, 6, dst_addr);
+ proto_tree_add_item(vmlab_tree, hf_vmlab_eth_dst, tvb, offset, 6, ENC_NA);
offset += 6;
/* Source MAC*/
src_addr=tvb_get_ptr(tvb, offset, 6);
- proto_tree_add_ether(vmlab_tree, hf_vmlab_eth_src, tvb, offset, 6, src_addr);
+ proto_tree_add_item(vmlab_tree, hf_vmlab_eth_src, tvb, offset, 6, ENC_NA);
offset += 6;
proto_item_append_text(ti, ", Src: %s (%s), Dst: %s (%s)",
diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c
index e861d5ec85..db96366154 100644
--- a/epan/dissectors/packet-wbxml.c
+++ b/epan/dissectors/packet-wbxml.c
@@ -1200,27 +1200,24 @@ static value_string_ext vals_wbxml1x_global_tokens_ext = VALUE_STRING_EXT_INIT(v
static char *
ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
{
- gint str_len = tvb_strsize (tvb, str_tbl + value);
char *str = g_strdup_printf("Variable substitution - escaped: '%s'",
- tvb_get_ptr(tvb, str_tbl + value, str_len));
+ tvb_get_const_stringz(tvb, str_tbl + value, NULL));
return str;
}
static char *
ext_t_1_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
{
- gint str_len = tvb_strsize (tvb, str_tbl + value);
char *str = g_strdup_printf("Variable substitution - unescaped: '%s'",
- tvb_get_ptr(tvb, str_tbl + value, str_len));
+ tvb_get_const_stringz(tvb, str_tbl + value, NULL));
return str;
}
static char *
ext_t_2_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
{
- gint str_len = tvb_strsize (tvb, str_tbl + value);
char *str = g_strdup_printf("Variable substitution - no transformation: '%s'",
- tvb_get_ptr(tvb, str_tbl + value, str_len));
+ tvb_get_const_stringz(tvb, str_tbl + value, NULL));
return str;
}
/***** Global extension tokens *****/
@@ -3029,7 +3026,7 @@ static const value_string wbxml_mssyncc10_tags_cp2[] = { /* ActiveSync POOMMAIL
{ 0x0c, "Body" },
{ 0x0d, "BodySize" },
{ 0x0e, "BodyTruncated" },
- { 0x0f, "DateReceived" },
+ { 0x0f, "DateReceived" },
{ 0x10, "DisplayName" },
{ 0x11, "DisplayTo" },
{ 0x12, "Importance" },
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 2544549d4a..e0dd6741fc 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -1860,8 +1860,7 @@ static guint dissect_zcl_attr_uint16(tvbuff_t *tvb, proto_tree *tree, guint *off
*/
static void dissect_zcl_attr_bytes(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint length)
{
- proto_tree_add_bytes(tree, hf_zbee_zcl_attr_bytes, tvb, *offset, length,
- tvb_get_ptr(tvb, *offset, length));
+ proto_tree_add_item(tree, hf_zbee_zcl_attr_bytes, tvb, *offset, length, ENC_NA);
*offset += length;
return;