aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/kerberos/kerberos.cnf
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-14 19:30:07 -0700
committerGuy Harris <guy@alum.mit.edu>2014-05-15 02:31:14 +0000
commitb8f0e8cf0311eb6485e494f40d3d142d4897f64b (patch)
treec1ed6cdcc41c8695e1af25795b18557f6cc9ea53 /asn1/kerberos/kerberos.cnf
parentd7f1ac33f6057eb8020a5664d28ea286d3acc364 (diff)
Eliminate some calls to tvb_get_ptr().
Change-Id: I1c5e10467d68ed7372dfaa9109b350238418ffc1 Reviewed-on: https://code.wireshark.org/review/1645 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'asn1/kerberos/kerberos.cnf')
-rw-r--r--asn1/kerberos/kerberos.cnf14
1 files changed, 6 insertions, 8 deletions
diff --git a/asn1/kerberos/kerberos.cnf b/asn1/kerberos/kerberos.cnf
index dea3eb561f..e142d6ca8b 100644
--- a/asn1/kerberos/kerberos.cnf
+++ b/asn1/kerberos/kerberos.cnf
@@ -173,7 +173,7 @@ guint32 msgtype;
gboolean pc;
gint32 tag;
guint32 len;
- char *address_str;
+ const char *address_str;
proto_item *it=NULL;
kerberos_private_data_t *private_data = kerberos_get_private_data(actx);
@@ -181,12 +181,10 @@ guint32 msgtype;
offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag);
offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL);
- address_str=(char*)wmem_alloc(wmem_packet_scope(), ADDRESS_STR_BUFSIZ);
- address_str[0]=0;
switch(private_data->addr_type){
case KERBEROS_ADDR_TYPE_IPV4:
it=proto_tree_add_item(tree, hf_krb_address_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
- g_snprintf(address_str,ADDRESS_STR_BUFSIZ,"%d.%d.%d.%d",tvb_get_guint8(tvb, offset),tvb_get_guint8(tvb, offset+1),tvb_get_guint8(tvb, offset+2),tvb_get_guint8(tvb, offset+3));
+ address_str = tvb_ip_to_str(tvb, offset);
break;
case KERBEROS_ADDR_TYPE_NETBIOS:
{
@@ -195,21 +193,21 @@ guint32 msgtype;
int netbios_name_len = (NETBIOS_NAME_LEN - 1)*4 + 1;
netbios_name_type = process_netbios_name(tvb_get_ptr(tvb, offset, 16), netbios_name, netbios_name_len);
- g_snprintf(address_str, ADDRESS_STR_BUFSIZ, "%s<%02x>", netbios_name, netbios_name_type);
+ address_str = wmem_strdup_printf(wmem_packet_scope(), "%s<%02x>", netbios_name, netbios_name_type);
it=proto_tree_add_string_format(tree, hf_krb_address_netbios, tvb, offset, 16, netbios_name, "NetBIOS Name: %s (%s)", address_str, netbios_name_type_descr(netbios_name_type));
}
break;
case KERBEROS_ADDR_TYPE_IPV6:
it=proto_tree_add_item(tree, hf_krb_address_ipv6, tvb, offset, INET6_ADDRLEN, ENC_NA);
- g_snprintf(address_str, ADDRESS_STR_BUFSIZ, "%s", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset, INET6_ADDRLEN)));
+ address_str = tvb_ip6_to_str(tvb, offset);
break;
default:
proto_tree_add_text(tree, tvb, offset, len, "KRB Address: I dont know how to parse this type of address yet");
-
+ address_str = NULL;
}
/* push it up two levels in the decode pane */
- if(it){
+ if(it && address_str){
proto_item_append_text(proto_item_get_parent(it), " %s",address_str);
proto_item_append_text(proto_item_get_parent_nth(it, 2), " %s",address_str);
}