Replace some tvb_get_ptr()s with tvb_get_ephemeral_string()s to ensure the
return string is NULL terminated. 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(). svn path=/trunk/; revision=35548
This commit is contained in:
parent
d553df218e
commit
61876001c3
|
@ -1384,7 +1384,7 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
|
||||
tvb_get_ptr(tvb, offset, 8));
|
||||
tvb_get_ephemeral_string(tvb, offset, 8));
|
||||
}
|
||||
if( tree ){
|
||||
proto_tree_add_item(artnet_header_tree, hf_artnet_header_id,
|
||||
|
|
|
@ -378,7 +378,7 @@ static const value_string pkt_cccV6_opt_vals[] = {
|
|||
{ PKT_CCCV6_PROV_TIMER, "TSP's Provisioning Timer Value" },
|
||||
{ PKT_CCCV6_IETF_SEC_TKT, "PacketCable Security Ticket Control" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
};
|
||||
|
||||
static const value_string sec_tcm_vals[] = {
|
||||
{ 1 << 0, "PacketCable Provisioning Server" },
|
||||
|
@ -624,7 +624,7 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
"Sub element %d: no room left in option for suboption length",
|
||||
subopt);
|
||||
return (optend);
|
||||
}
|
||||
}
|
||||
|
||||
vti = proto_tree_add_text(v_tree, tvb, optoff, subopt_len + 4,
|
||||
"Sub element %u: %s: ", subopt,
|
||||
|
@ -664,7 +664,7 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
}
|
||||
} else {
|
||||
proto_item_append_text(vti, "Invalid type: %u (%u byte%s)",
|
||||
type, subopt_len, plurality(subopt_len, "", "s"));
|
||||
type, subopt_len, plurality(subopt_len, "", "s"));
|
||||
}
|
||||
suboptoff += subopt_len;
|
||||
break;
|
||||
|
@ -673,11 +673,11 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
case PKT_CCCV6_IETF_AP_KRB:
|
||||
if (subopt_len == 12) {
|
||||
pkt_s_tree = proto_item_add_subtree(vti, ett_dhcpv6_pkt_option);
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff, 4,
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff, 4,
|
||||
"Nominal Timeout : %u", tvb_get_ntohl(tvb, suboptoff));
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff+4, 4,
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff+4, 4,
|
||||
"Maximum Timeout : %u", tvb_get_ntohl(tvb, suboptoff+4));
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff+8, 4,
|
||||
proto_tree_add_text(pkt_s_tree, tvb, suboptoff+8, 4,
|
||||
"Maximum Retry Count : %u", tvb_get_ntohl(tvb, suboptoff+8));
|
||||
} else {
|
||||
proto_item_append_text(vti, "Bogus length: %d", subopt_len);
|
||||
|
@ -690,13 +690,13 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
for (i=0; i < subopt_len; i++) {
|
||||
kr_name = tvb_get_guint8(tvb, suboptoff + i);
|
||||
kr_value = (int)kr_name;
|
||||
if ((kr_value >= 65 && kr_value <= 90) ||
|
||||
kr_value == 34 ||
|
||||
kr_value == 44 ||
|
||||
kr_value == 46 ||
|
||||
kr_value == 47 ||
|
||||
kr_value == 58 ||
|
||||
kr_value == 61 ||
|
||||
if ((kr_value >= 65 && kr_value <= 90) ||
|
||||
kr_value == 34 ||
|
||||
kr_value == 44 ||
|
||||
kr_value == 46 ||
|
||||
kr_value == 47 ||
|
||||
kr_value == 58 ||
|
||||
kr_value == 61 ||
|
||||
kr_value == 92) {
|
||||
} else if (!kr_fail_flag) {
|
||||
kr_pos = i;
|
||||
|
@ -708,15 +708,15 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
if (kr_fail_flag) {
|
||||
proto_item_append_text(vti, " (%u byte%s [Invalid at byte=%d]) ",
|
||||
subopt_len,
|
||||
plurality(subopt_len, "", "s"),
|
||||
plurality(subopt_len, "", "s"),
|
||||
kr_pos);
|
||||
} else {
|
||||
proto_item_append_text(vti, " (%u byte%s%s) ",
|
||||
subopt_len,
|
||||
plurality(subopt_len, "", "s"),
|
||||
plurality(subopt_len, "", "s"),
|
||||
kr_fail_flag != 0 ? " [Invalid]" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
suboptoff += subopt_len;
|
||||
break;
|
||||
|
||||
|
@ -743,7 +743,7 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
sec_tcm = tvb_get_ntohs(tvb, suboptoff);
|
||||
proto_item_append_text(vti, "0x%04x (%u byte%s%s)",
|
||||
sec_tcm, subopt_len, plurality(subopt_len, "", "s"),
|
||||
subopt_len != 2 ? " [Invalid]" : "");
|
||||
subopt_len != 2 ? " [Invalid]" : "");
|
||||
|
||||
if (subopt_len == 2) {
|
||||
pkt_s_tree = proto_item_add_subtree(vti, ett_dhcpv6_pkt_option);
|
||||
|
@ -763,7 +763,7 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, tvbuff_t *tvb, int optoff,
|
|||
suboptoff += subopt_len;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/** Return the number of bytes processed **/
|
||||
return (suboptoff - optoff);
|
||||
}
|
||||
|
@ -815,7 +815,7 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, tvbuff_t *tvb, int voff, int
|
|||
tvb_format_stringzpad(tvb, sub_off, field_len));
|
||||
break;
|
||||
|
||||
case CL_OPTION_VENDOR_OUI :
|
||||
case CL_OPTION_VENDOR_OUI :
|
||||
/* CableLabs specs treat 17.8 inconsistently
|
||||
* as either binary (3b) or string (6b) */
|
||||
opt_len = tlv_len;
|
||||
|
@ -979,7 +979,7 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, tvbuff_t *tvb, int voff, int
|
|||
subtree = proto_item_add_subtree(ti, ett_dhcpv6_vendor_option);
|
||||
proto_item_append_text(ti, " (%d bytes)", opt_len);
|
||||
while (field_len < opt_len) {
|
||||
sub_value = dissect_packetcable_cccV6_option(subtree, tvb,
|
||||
sub_value = dissect_packetcable_cccV6_option(subtree, tvb,
|
||||
sub_off, (opt_len - field_len));
|
||||
sub_off += sub_value;
|
||||
field_len += sub_value;
|
||||
|
@ -1828,7 +1828,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
|
|||
break;
|
||||
}
|
||||
proto_tree_add_text(subtree, tvb, off, optlen,
|
||||
"NAI : %s", tvb_get_ptr(tvb, off, optlen - 2));
|
||||
"NAI : %s", tvb_get_ephemeral_string(tvb, off, optlen - 2));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -592,9 +592,8 @@ dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
|
|||
len = tvb_get_guint8 (tvb, offset);
|
||||
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,
|
||||
tvb_get_ptr (tvb, offset+1, len));
|
||||
proto_tree_add_item (req_tree, hf_fcdns_rply_spname, tvb,
|
||||
offset+1, len, ENC_NA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1256,7 +1255,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int 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,
|
||||
3, fc_to_str (tvb_get_ptr (tvb, offset+1,
|
||||
3, fc_to_str (tvb_get_ephemeral_string (tvb, offset+1,
|
||||
3)));
|
||||
proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4,
|
||||
1, 0);
|
||||
|
@ -1443,8 +1442,8 @@ dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq)
|
|||
str_len = tvb_get_guint8 (tvb, offset);
|
||||
proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d",
|
||||
str_len);
|
||||
proto_tree_add_string (req_tree, hf_fcdns_zonenm, tvb, offset+3,
|
||||
str_len, tvb_get_ptr (tvb, offset+3, str_len));
|
||||
proto_tree_add_item (req_tree, hf_fcdns_zonenm, tvb, offset+3,
|
||||
str_len, ENC_NA);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -499,8 +499,8 @@ dissect_mipv6_hoa(tvbuff_t *tvb, proto_tree *dstopt_tree, int offset, packet_inf
|
|||
1, tvb_get_guint8(tvb, offset + len));
|
||||
len += 1;
|
||||
|
||||
proto_tree_add_ipv6(dstopt_tree, hf_ipv6_mipv6_home_address, tvb,
|
||||
offset + len, 16, tvb_get_ptr(tvb, offset + len, 16));
|
||||
proto_tree_add_item(dstopt_tree, hf_ipv6_mipv6_home_address, tvb,
|
||||
offset + len, 16, ENC_NA);
|
||||
SET_ADDRESS(&pinfo->src, AT_IPv6, 16, tvb_get_ptr(tvb, offset + len, 16));
|
||||
len += 16;
|
||||
return len;
|
||||
|
|
|
@ -247,7 +247,6 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
char *str;
|
||||
guint16 first_socket, second_socket;
|
||||
guint32 ipx_snet, ipx_dnet;
|
||||
const guint8 *ipx_snode, *ipx_dnode;
|
||||
static ipxhdr_t ipxh_arr[4];
|
||||
static int ipx_current=0;
|
||||
ipxhdr_t *ipxh;
|
||||
|
@ -321,11 +320,8 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
hidden_item = proto_tree_add_ipxnet(ipx_tree, hf_ipx_net, tvb, 6, 4,
|
||||
ipx_dnet);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
ipx_dnode = tvb_get_ptr(tvb, 10, 6);
|
||||
proto_tree_add_ether(ipx_tree, hf_ipx_dnode, tvb, 10, 6,
|
||||
ipx_dnode);
|
||||
hidden_item = proto_tree_add_ether(ipx_tree, hf_ipx_node, tvb, 10, 6,
|
||||
ipx_dnode);
|
||||
proto_tree_add_item(ipx_tree, hf_ipx_dnode, tvb, 10, 6, ENC_NA);
|
||||
hidden_item = proto_tree_add_item(ipx_tree, hf_ipx_node, tvb, 10, 6, ENC_NA);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_uint(ipx_tree, hf_ipx_dsocket, tvb, 16, 2,
|
||||
ipxh->ipx_dsocket);
|
||||
|
@ -340,11 +336,8 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
hidden_item = proto_tree_add_ipxnet(ipx_tree, hf_ipx_net, tvb, 18, 4,
|
||||
ipx_snet);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
ipx_snode = tvb_get_ptr(tvb, 22, 6);
|
||||
proto_tree_add_ether(ipx_tree, hf_ipx_snode, tvb, 22, 6,
|
||||
ipx_snode);
|
||||
hidden_item = proto_tree_add_ether(ipx_tree, hf_ipx_node, tvb, 22, 6,
|
||||
ipx_snode);
|
||||
proto_tree_add_item(ipx_tree, hf_ipx_snode, tvb, 22, 6, ENC_NA);
|
||||
hidden_item = proto_tree_add_item(ipx_tree, hf_ipx_node, tvb, 22, 6, ENC_NA);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_uint(ipx_tree, hf_ipx_ssocket, tvb, 28, 2,
|
||||
ipxh->ipx_ssocket);
|
||||
|
|
|
@ -2285,7 +2285,6 @@ dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gu
|
|||
guint32 port_tx_delay_local;
|
||||
guint32 port_tx_delay_remote;
|
||||
guint32 cable_delay_local;
|
||||
const guint8 *mac_addr = NULL;
|
||||
e_guid_t * uuid;
|
||||
guint16 mrrt_PortStatus;
|
||||
|
||||
|
@ -2368,16 +2367,14 @@ dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gu
|
|||
}
|
||||
case 5: /* LLDP_PNIO_CHASSIS_MAC */
|
||||
{
|
||||
mac_addr=tvb_get_ptr(tvb, offset, 6);
|
||||
proto_tree_add_ether(tree, hf_profinet_cm_mac, tvb, offset, 6, mac_addr);
|
||||
proto_tree_add_item(tree, hf_profinet_cm_mac, tvb, offset, 6, ENC_NA);
|
||||
offset += 6;
|
||||
break;
|
||||
}
|
||||
case 6: /* LLDP_PNIO_PTCPSTATUS */
|
||||
{
|
||||
/* MasterSourceAddress */
|
||||
mac_addr=tvb_get_ptr(tvb, offset, 6);
|
||||
proto_tree_add_ether(tree, hf_profinet_master_source_address, tvb, offset, 6, mac_addr);
|
||||
proto_tree_add_item(tree, hf_profinet_master_source_address, tvb, offset, 6, ENC_NA);
|
||||
offset += 6;
|
||||
/* SubdomainUUID */
|
||||
tvb_get_ntohguid (tvb, offset, (e_guid_t *) &uuid);
|
||||
|
|
|
@ -205,7 +205,7 @@ static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree)
|
|||
{
|
||||
guint32 flags,family;
|
||||
guint16 addrlen, slen;
|
||||
const guint8* addr;
|
||||
const char* addrs;
|
||||
|
||||
proto_item* nba_request_item;
|
||||
proto_tree* nba_request_tree;
|
||||
|
@ -213,8 +213,8 @@ static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree)
|
|||
flags = tvb_get_ntohl(tvb, LWRES_LWPACKET_LENGTH);
|
||||
family = tvb_get_ntohl(tvb, LWRES_LWPACKET_LENGTH + 4);
|
||||
addrlen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 8);
|
||||
addr = tvb_get_ptr(tvb, LWRES_LWPACKET_LENGTH + 10, 4);
|
||||
slen = (int)strlen(ip_to_str(addr));
|
||||
addrs = tvb_ip_to_str(tvb, LWRES_LWPACKET_LENGTH + 10);
|
||||
slen = (int)strlen(addrs);
|
||||
|
||||
if(lwres_tree)
|
||||
{
|
||||
|
@ -223,33 +223,17 @@ static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree)
|
|||
}
|
||||
else return;
|
||||
|
||||
proto_tree_add_uint(nba_request_tree,
|
||||
hf_adn_flags,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH,
|
||||
4,
|
||||
flags);
|
||||
proto_tree_add_uint(nba_request_tree, hf_adn_flags, tvb,
|
||||
LWRES_LWPACKET_LENGTH, 4, flags);
|
||||
|
||||
proto_tree_add_uint(nba_request_tree,
|
||||
hf_adn_family,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 4,
|
||||
4,
|
||||
family);
|
||||
proto_tree_add_uint(nba_request_tree, hf_adn_family, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 4, 4, family);
|
||||
|
||||
proto_tree_add_uint(nba_request_tree,
|
||||
hf_adn_addr_len,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 8,
|
||||
2,
|
||||
addrlen);
|
||||
proto_tree_add_uint(nba_request_tree, hf_adn_addr_len, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 8, 2, addrlen);
|
||||
|
||||
proto_tree_add_string(nba_request_tree,
|
||||
hf_adn_addr_addr,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 10,
|
||||
slen,
|
||||
ip_to_str(addr));
|
||||
proto_tree_add_string(nba_request_tree, hf_adn_addr_addr, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 10, slen, addrs);
|
||||
|
||||
}
|
||||
|
||||
|
@ -389,16 +373,16 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
|
|||
{
|
||||
guint32 family ,i, offset;
|
||||
guint16 naliases, naddrs, realnamelen, length, aliaslen;
|
||||
const gchar* addr;
|
||||
const gchar* addrs;
|
||||
guint slen;
|
||||
gchar *aliasname;
|
||||
|
||||
proto_item* adn_resp_item;
|
||||
proto_tree* adn_resp_tree;
|
||||
proto_item* alias_item;
|
||||
proto_tree* alias_tree;
|
||||
proto_item* addr_item;
|
||||
proto_tree* addr_tree;
|
||||
proto_item *adn_resp_item;
|
||||
proto_tree *adn_resp_tree;
|
||||
proto_item *alias_item;
|
||||
proto_tree *alias_tree;
|
||||
proto_item *addr_item;
|
||||
proto_tree *addr_tree;
|
||||
|
||||
|
||||
|
||||
|
@ -414,40 +398,20 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
|
|||
realnamelen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 8);
|
||||
|
||||
|
||||
proto_tree_add_item(adn_resp_tree,
|
||||
hf_adn_flags,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH,
|
||||
4,
|
||||
FALSE);
|
||||
proto_tree_add_item(adn_resp_tree, hf_adn_flags, tvb,
|
||||
LWRES_LWPACKET_LENGTH, 4, FALSE);
|
||||
|
||||
proto_tree_add_item(adn_resp_tree,
|
||||
hf_adn_naliases,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 4,
|
||||
2,
|
||||
FALSE);
|
||||
proto_tree_add_item(adn_resp_tree, hf_adn_naliases, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 4, 2, FALSE);
|
||||
|
||||
proto_tree_add_item(adn_resp_tree,
|
||||
hf_adn_naddrs,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 6,
|
||||
2,
|
||||
FALSE);
|
||||
proto_tree_add_item(adn_resp_tree, hf_adn_naddrs, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 6, 2, FALSE);
|
||||
|
||||
proto_tree_add_item(adn_resp_tree,
|
||||
hf_adn_namelen,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 8,
|
||||
2,
|
||||
FALSE);
|
||||
proto_tree_add_item(adn_resp_tree, hf_adn_namelen, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 8, 2, FALSE);
|
||||
|
||||
proto_tree_add_item(adn_resp_tree,
|
||||
hf_adn_realname,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH + 10,
|
||||
realnamelen,
|
||||
FALSE);
|
||||
proto_tree_add_item(adn_resp_tree, hf_adn_realname, tvb,
|
||||
LWRES_LWPACKET_LENGTH + 10, realnamelen, FALSE);
|
||||
|
||||
offset = LWRES_LWPACKET_LENGTH + 10 + realnamelen + 1;
|
||||
|
||||
|
@ -461,19 +425,11 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
|
|||
alias_item = proto_tree_add_text(adn_resp_tree, tvb, offset, 2 + aliaslen, "Alias %s",aliasname);
|
||||
alias_tree = proto_item_add_subtree(alias_item, ett_adn_alias);
|
||||
|
||||
proto_tree_add_uint(alias_tree,
|
||||
hf_adn_namelen,
|
||||
tvb,
|
||||
offset,
|
||||
2,
|
||||
aliaslen);
|
||||
proto_tree_add_uint(alias_tree, hf_adn_namelen, tvb,
|
||||
offset, 2, aliaslen);
|
||||
|
||||
proto_tree_add_item(alias_tree,
|
||||
hf_adn_aliasname,
|
||||
tvb,
|
||||
offset + 2,
|
||||
aliaslen,
|
||||
FALSE);
|
||||
proto_tree_add_item(alias_tree, hf_adn_aliasname, tvb,
|
||||
offset + 2, aliaslen, FALSE);
|
||||
|
||||
offset+=(2 + aliaslen + 1);
|
||||
}
|
||||
|
@ -485,32 +441,20 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
|
|||
{
|
||||
family = tvb_get_ntohl(tvb, offset);
|
||||
length = tvb_get_ntohs(tvb, offset + 4);
|
||||
addr = (gchar*)tvb_get_ptr(tvb, offset + 6, 4);
|
||||
slen = (int)strlen((char*)ip_to_str((guint8*)addr));
|
||||
addrs = tvb_ip_to_str(tvb, offset + 6);
|
||||
slen = (int)strlen(addrs);
|
||||
|
||||
addr_item = proto_tree_add_text(adn_resp_tree,tvb, offset, 4+2+4, "Address %s",ip_to_str((guint8*)addr));
|
||||
addr_item = proto_tree_add_text(adn_resp_tree,tvb, offset, 4+2+4, "Address %s", addrs);
|
||||
addr_tree = proto_item_add_subtree(addr_item, ett_adn_addr);
|
||||
|
||||
proto_tree_add_uint(addr_tree,
|
||||
hf_adn_family,
|
||||
tvb,
|
||||
offset,
|
||||
4,
|
||||
family);
|
||||
proto_tree_add_uint(addr_tree, hf_adn_family, tvb,
|
||||
offset, 4, family);
|
||||
|
||||
proto_tree_add_uint(addr_tree,
|
||||
hf_adn_addr_len,
|
||||
tvb,
|
||||
offset + 4,
|
||||
2,
|
||||
length);
|
||||
proto_tree_add_uint(addr_tree, hf_adn_addr_len, tvb,
|
||||
offset + 4, 2, length);
|
||||
|
||||
proto_tree_add_string(addr_tree,
|
||||
hf_adn_addr_addr,
|
||||
tvb,
|
||||
offset + 6,
|
||||
slen,
|
||||
ip_to_str((guint8*)addr));
|
||||
proto_tree_add_string(addr_tree, hf_adn_addr_addr, tvb,
|
||||
offset + 6, slen, addrs);
|
||||
|
||||
offset+= 4 + 2 + 4;
|
||||
}
|
||||
|
@ -522,7 +466,7 @@ static void dissect_getaddrsbyname_response(tvbuff_t* tvb, proto_tree* lwres_tre
|
|||
static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int offset)
|
||||
{
|
||||
guint32 i, curr;
|
||||
const gchar* addr;
|
||||
const gchar* addrs;
|
||||
guint16 len;
|
||||
proto_item* a_rec_item;
|
||||
proto_tree* a_rec_tree;
|
||||
|
@ -545,29 +489,21 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o
|
|||
curr = offset + ((sizeof(guint32)+sizeof(guint16)) * i);
|
||||
|
||||
len = tvb_get_ntohs(tvb,curr);
|
||||
addr = (gchar*)tvb_get_ptr(tvb,curr+2,4);
|
||||
|
||||
addrs = tvb_ip_to_str(tvb, curr+2);
|
||||
if(a_rec_tree)
|
||||
{
|
||||
addr_item = proto_tree_add_text(a_rec_tree,tvb, curr, 6,"IP Address");
|
||||
addr_item = proto_tree_add_text(a_rec_tree, tvb, curr,
|
||||
6, "Address %s", addrs);
|
||||
addr_tree = proto_item_add_subtree(addr_item, ett_a_rec_addr);
|
||||
proto_item_set_text(addr_item,"Address %s",ip_to_str((guint8*)addr));
|
||||
}
|
||||
else return;
|
||||
|
||||
proto_tree_add_uint(addr_tree,
|
||||
hf_a_rec_len,
|
||||
tvb,
|
||||
curr,
|
||||
sizeof(guint16),
|
||||
len);
|
||||
proto_tree_add_uint(addr_tree, hf_a_rec_len, tvb, curr,
|
||||
sizeof(guint16), len);
|
||||
|
||||
proto_tree_add_text(addr_tree,
|
||||
tvb,
|
||||
curr + 2,
|
||||
4,
|
||||
"Addr: %s",
|
||||
ip_to_str((guint8*)addr));
|
||||
proto_tree_add_text(addr_tree, tvb, curr + 2, 4, "Addr: %s",
|
||||
addrs);
|
||||
|
||||
}
|
||||
|
||||
|
@ -905,13 +841,11 @@ static void dissect_rdata_response(tvbuff_t* tvb, proto_tree* lwres_tree)
|
|||
static void dissect_noop(tvbuff_t* tvb, proto_tree* lwres_tree)
|
||||
{
|
||||
guint16 datalen;
|
||||
const char* data;
|
||||
|
||||
proto_item* noop_item;
|
||||
proto_tree* noop_tree;
|
||||
|
||||
datalen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH);
|
||||
data = (char*)tvb_get_ptr(tvb, LWRES_LWPACKET_LENGTH, datalen);
|
||||
|
||||
if(lwres_tree)
|
||||
{
|
||||
|
@ -921,12 +855,10 @@ static void dissect_noop(tvbuff_t* tvb, proto_tree* lwres_tree)
|
|||
else
|
||||
return;
|
||||
|
||||
proto_tree_add_uint(noop_tree,
|
||||
hf_length,
|
||||
tvb,
|
||||
LWRES_LWPACKET_LENGTH,
|
||||
sizeof(guint16),
|
||||
datalen);
|
||||
proto_tree_add_uint(noop_tree, hf_length, tvb,
|
||||
LWRES_LWPACKET_LENGTH, sizeof(guint16), datalen);
|
||||
|
||||
tvb_ensure_bytes_exist(tvb, LWRES_LWPACKET_LENGTH, datalen);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue