diff --git a/epan/dissectors/packet-dcerpc-epm.c b/epan/dissectors/packet-dcerpc-epm.c index 8cd8575a5f..796a53c016 100644 --- a/epan/dissectors/packet-dcerpc-epm.c +++ b/epan/dissectors/packet-dcerpc-epm.c @@ -334,7 +334,7 @@ epm_dissect_tower_data (tvbuff_t *tvb, int offset, case PROTO_ID_UUID: dcerpc_tvb_get_uuid (tvb, offset+1, &u8little_endian, &uuid); - uuid_name = guids_get_uuid_name(&uuid); + uuid_name = guids_get_uuid_name(&uuid, pinfo->pool); if(uuid_name != NULL) { proto_tree_add_guid_format (tr, hf_epm_uuid, tvb, offset+1, 16, (e_guid_t *) &uuid, diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 1a4f2d188c..862cb2dd77 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -3502,7 +3502,7 @@ dissect_sec_vt_pcontext(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb) const char *uuid_name; tvb_get_letohguid(tvb, offset, &uuid); - uuid_name = guids_get_uuid_name(&uuid); + uuid_name = guids_get_uuid_name(&uuid, pinfo->pool); if (!uuid_name) { uuid_name = guid_to_str(pinfo->pool, &uuid); } @@ -3516,7 +3516,7 @@ dissect_sec_vt_pcontext(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb) offset += 4; tvb_get_letohguid(tvb, offset, &uuid); - uuid_name = guids_get_uuid_name(&uuid); + uuid_name = guids_get_uuid_name(&uuid, pinfo->pool); if (!uuid_name) { uuid_name = guid_to_str(pinfo->pool, &uuid); } @@ -3762,7 +3762,7 @@ dcerpc_try_handoff(packet_info *pinfo, proto_tree *tree, tvb, offset, 0, TRUE); proto_item_set_hidden(hidden_item); col_append_fstr(pinfo->cinfo, COL_INFO, " %s V%u", - guids_resolve_guid_to_str(&info->call_data->uuid), info->call_data->ver); + guids_resolve_guid_to_str(&info->call_data->uuid, pinfo->pool), info->call_data->ver); show_stub_data(pinfo, tvb, 0, dcerpc_tree, auth_info, !decrypted); return -1; @@ -4063,7 +4063,7 @@ dissect_dcerpc_cn_bind(tvbuff_t *tvb, gint offset, packet_info *pinfo, iface_tree = proto_item_add_subtree(iface_item, ett_dcerpc_cn_iface); uuid_str = guid_to_str(pinfo->pool, (e_guid_t*)&if_id); - uuid_name = guids_get_uuid_name(&if_id); + uuid_name = guids_get_uuid_name(&if_id, pinfo->pool); if (uuid_name) { proto_tree_add_guid_format(iface_tree, hf_dcerpc_cn_bind_if_id, tvb, offset, 16, (e_guid_t *) &if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); @@ -4107,7 +4107,7 @@ dissect_dcerpc_cn_bind(tvbuff_t *tvb, gint offset, packet_info *pinfo, trans_tree = proto_item_add_subtree(trans_item, ett_dcerpc_cn_trans_syntax); uuid_str = guid_to_str(pinfo->pool, (e_guid_t *) &trans_id); - uuid_name = guids_get_uuid_name(&trans_id); + uuid_name = guids_get_uuid_name(&trans_id, pinfo->pool); /* check for [MS-RPCE] 3.3.1.5.3 Bind Time Feature Negotiation */ if (trans_id.data1 == 0x6cb71c2c && trans_id.data2 == 0x9812 && trans_id.data3 == 0x4540) { @@ -4173,8 +4173,8 @@ dissect_dcerpc_cn_bind(tvbuff_t *tvb, gint offset, packet_info *pinfo, if (i > 0) col_append_fstr(pinfo->cinfo, COL_INFO, ","); col_append_fstr(pinfo->cinfo, COL_INFO, " %s V%u.%u (%s)", - guids_resolve_guid_to_str(&if_id), if_ver, if_ver_minor, - guids_resolve_guid_to_str(&trans_id)); + guids_resolve_guid_to_str(&if_id, pinfo->pool), if_ver, if_ver_minor, + guids_resolve_guid_to_str(&trans_id, pinfo->pool)); if (ctx_tree) { proto_item_set_len(ctx_item, offset - ctx_offset); @@ -4271,7 +4271,7 @@ dissect_dcerpc_cn_bind_ack(tvbuff_t *tvb, gint offset, packet_info *pinfo, if (ctx_tree) { dcerpc_tvb_get_uuid(tvb, offset, hdr->drep, &trans_id); - uuid_name = guids_get_uuid_name(&trans_id); + uuid_name = guids_get_uuid_name(&trans_id, pinfo->pool); if (! uuid_name) { uuid_name = guid_to_str(pinfo->pool, (e_guid_t *) &trans_id); } @@ -6525,7 +6525,7 @@ dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat if (tree) { uuid_str = guid_to_str(pinfo->pool, (e_guid_t*)&hdr.if_id); - uuid_name = guids_get_uuid_name(&hdr.if_id); + uuid_name = guids_get_uuid_name(&hdr.if_id, pinfo->pool); if (uuid_name) { proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_dg_if_id, tvb, offset, 16, (e_guid_t *) &hdr.if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); diff --git a/epan/dissectors/packet-dcom-remunkn.c b/epan/dissectors/packet-dcom-remunkn.c index f48c41e24c..3e020d39b9 100644 --- a/epan/dissectors/packet-dcom-remunkn.c +++ b/epan/dissectors/packet-dcom-remunkn.c @@ -248,7 +248,7 @@ dissect_remunk_remrelease_rqst(tvbuff_t *tvb, int offset, /* update subtree */ proto_item_append_text(sub_item, "[%u]: IPID=%s, PublicRefs=%u, PrivateRefs=%u", u32ItemIdx, - guids_resolve_guid_to_str(&ipid), + guids_resolve_guid_to_str(&ipid, pinfo->pool), u32PublicRefs, u32PrivateRefs); proto_item_set_len(sub_item, offset - u32SubStart); diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index 41941bfff0..f5fc4f4645 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -726,7 +726,7 @@ dissect_dcom_extent(tvbuff_t *tvb, int offset, hf_dcom_extent_id, &uuidExtend); /* look for a registered uuid name */ - if((uuid_name = guids_get_uuid_name(&uuidExtend)) != NULL) { + if((uuid_name = guids_get_uuid_name(&uuidExtend, pinfo->pool)) != NULL) { proto_tree_add_guid_format_value(sub_tree, hf_dcom_extent_id, tvb, offset, sizeof(e_guid_t), (e_guid_t *) &uuidExtend, "%s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)", @@ -804,13 +804,13 @@ dissect_dcom_this(tvbuff_t *tvb, int offset, /* update subtree header */ proto_item_append_text(sub_item, ", V%u.%u, Causality ID: %s", - u16VersionMajor, u16VersionMinor, guids_resolve_guid_to_str(&uuidCausality)); + u16VersionMajor, u16VersionMinor, guids_resolve_guid_to_str(&uuidCausality, pinfo->pool)); proto_item_set_len(sub_item, offset - u32SubStart); if(memcmp(&di->call_data->object_uuid, &uuid_null, sizeof(uuid_null)) != 0) { pi = proto_tree_add_guid_format(tree, hf_dcom_ipid, tvb, offset, 0, (e_guid_t *) &di->call_data->object_uuid, - "Object UUID/IPID: %s", guids_resolve_guid_to_str(&di->call_data->object_uuid)); + "Object UUID/IPID: %s", guids_resolve_guid_to_str(&di->call_data->object_uuid, pinfo->pool)); proto_item_set_generated(pi); } @@ -844,7 +844,7 @@ dissect_dcom_that(tvbuff_t *tvb, int offset, if(memcmp(&di->call_data->object_uuid, &uuid_null, sizeof(uuid_null)) != 0) { pi = proto_tree_add_guid_format(tree, hf_dcom_ipid, tvb, offset, 0, (e_guid_t *) &di->call_data->object_uuid, - "Object UUID/IPID: %s", guids_resolve_guid_to_str(&di->call_data->object_uuid)); + "Object UUID/IPID: %s", guids_resolve_guid_to_str(&di->call_data->object_uuid, pinfo->pool)); proto_item_set_generated(pi); } @@ -1472,7 +1472,7 @@ dissect_dcom_UUID(tvbuff_t *tvb, int offset, /* add to the tree */ hfi = proto_registrar_get_nth(hfindex); - uuid_name = guids_get_uuid_name(&uuid); + uuid_name = guids_get_uuid_name(&uuid, pinfo->pool); if(uuid_name) { proto_tree_add_guid_format(tree, hfindex, tvb, offset-16, 16, (e_guid_t *) &uuid, "%s: %s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)", @@ -1518,7 +1518,7 @@ dissect_dcom_append_UUID(tvbuff_t *tvb, int offset, hfindex, uuid); /* look for a registered uuid name */ - uuid_name = guids_get_uuid_name(uuid); + uuid_name = guids_get_uuid_name(uuid, pinfo->pool); /* add to the tree */ hfi = proto_registrar_get_nth(hfindex); @@ -1912,7 +1912,7 @@ dissect_dcom_STDOBJREF(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* append info to subtree header */ proto_item_append_text(sub_item, ": PublicRefs=%u IPID=%s", - u32PublicRefs, guids_resolve_guid_to_str(ipid)); + u32PublicRefs, guids_resolve_guid_to_str(ipid, pinfo->pool)); proto_item_set_len(sub_item, offset - u32SubStart); return offset; diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c index 47fd97ef6b..22917e0063 100644 --- a/epan/dissectors/packet-dtpt.c +++ b/epan/dissectors/packet-dtpt.c @@ -270,7 +270,7 @@ dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) } dtpt_guid_item = proto_tree_add_guid(tree, hfindex, tvb, offset, 4 + guid_length, &guid); if (dtpt_guid_item) { - guid_name = guids_get_guid_name(&guid); + guid_name = guids_get_guid_name(&guid, wmem_packet_scope()); if (guid_name != NULL) proto_item_set_text(dtpt_guid_item, "%s: %s (%s)", proto_registrar_get_name(hfindex), guid_name, guid_to_str(wmem_packet_scope(), &guid)); diff --git a/epan/dissectors/packet-etw.c b/epan/dissectors/packet-etw.c index dd56f0d886..0f80520ef1 100644 --- a/epan/dissectors/packet-etw.c +++ b/epan/dissectors/packet-etw.c @@ -162,7 +162,7 @@ dissect_etw(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree _U_, void* data col_set_str(pinfo->cinfo, COL_PROTOCOL, provider_name); } } else { - col_set_str(pinfo->cinfo, COL_INFO, guids_resolve_guid_to_str(&provider_id)); + col_set_str(pinfo->cinfo, COL_INFO, guids_resolve_guid_to_str(&provider_id, pinfo->pool)); } etw_counter += 1; diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c index 9ff7cec8f9..1b09dc5601 100644 --- a/epan/dissectors/packet-mswsp.c +++ b/epan/dissectors/packet-mswsp.c @@ -2960,7 +2960,7 @@ static void get_name_from_fullpropspec(struct CFullPropSpec *v, char *out, int b if (id_str) { g_snprintf(dest, bufsize, "%s", id_str); } else { - guid_str = guids_get_guid_name(&v->guid); + guid_str = guids_get_guid_name(&v->guid, wmem_packet_scope()); if (guid_str) { g_snprintf(dest, bufsize, "\"%s\"", guid_str); } else { @@ -3029,7 +3029,7 @@ static int parse_guid(tvbuff_t *tvb, int offset, proto_tree *tree, e_guid_t *gui tvb_get_letohguid(tvb, offset, guid); guid_str = guid_to_str(wmem_packet_scope(), guid); - name = guids_get_guid_name(guid); + name = guids_get_guid_name(guid, wmem_packet_scope()); tr = proto_tree_add_subtree_format(tree, tvb, offset, 16, ett_GUID, NULL, "%s: %s {%s}", text, name ? name : "", guid_str); @@ -3395,7 +3395,7 @@ static int parse_CFullPropSpec(tvbuff_t *tvb, int offset, proto_tree *parent_tre if (id_str) { proto_item_append_text(item, ": %s", id_str); } else { - guid_str = guids_get_guid_name(&v->guid); + guid_str = guids_get_guid_name(&v->guid, wmem_packet_scope()); if (guid_str) { proto_item_append_text(item, ": \"%s\"", guid_str); } else { diff --git a/epan/guid-utils.c b/epan/guid-utils.c index 544697f5c7..049e68bdb8 100644 --- a/epan/guid-utils.c +++ b/epan/guid-utils.c @@ -107,9 +107,9 @@ guids_add_guid(const e_guid_t *guid, const gchar *name) } -/* retrieve the registered name for this GUID */ +/* retrieve the registered name for this GUID; uses the scope for the fallback case only */ const gchar * -guids_get_guid_name(const e_guid_t *guid) +guids_get_guid_name(const e_guid_t *guid, wmem_allocator_t *scope _U_) { wmem_tree_key_t guidkey[2]; guint32 g[4]; @@ -151,7 +151,7 @@ guids_get_guid_name(const e_guid_t *guid) #ifdef _WIN32 /* try to resolve the mapping from the Windows registry */ /* XXX - prefill the resolving database with all the Windows registry entries once at init only (instead of searching each time)? */ - uuid_name=wmem_alloc(wmem_packet_scope(), 128); + uuid_name=wmem_alloc(scope, 128); if(ResolveWin32UUID(*guid, uuid_name, 128)) { return uuid_name; } @@ -171,19 +171,19 @@ guids_init(void) /* Tries to match a guid against its name. Returns the associated string ptr on a match. - Formats uuid number and returns the resulting string, if name is unknown. + Formats uuid number and returns the resulting string via wmem scope, if name is unknown. (derived from val_to_str) */ const gchar * -guids_resolve_guid_to_str(const e_guid_t *guid) +guids_resolve_guid_to_str(const e_guid_t *guid, wmem_allocator_t *scope) { const gchar *name; - name=guids_get_guid_name(guid); + name=guids_get_guid_name(guid, scope); if(name){ return name; } - return wmem_strdup_printf(wmem_packet_scope(), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + return wmem_strdup_printf(scope, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", guid->data1, guid->data2, guid->data3, guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3], diff --git a/epan/guid-utils.h b/epan/guid-utils.h index b33f50f6e2..5bccb4785f 100644 --- a/epan/guid-utils.h +++ b/epan/guid-utils.h @@ -13,6 +13,7 @@ #define __GUID_UTILS_H__ #include "ws_symbol_export.h" +#include #define GUID_LEN 16 @@ -35,17 +36,17 @@ WS_DLL_PUBLIC void guids_init(void); WS_DLL_PUBLIC void guids_add_guid(const e_guid_t *guid, const gchar *name); /* try to get registered name for this GUID */ -WS_DLL_PUBLIC const gchar *guids_get_guid_name(const e_guid_t *guid); +WS_DLL_PUBLIC const gchar *guids_get_guid_name(const e_guid_t *guid, wmem_allocator_t *scope); /* resolve GUID to name (or if unknown to hex string) */ /* (if you need hex string only, use guid_to_str instead) */ -WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid); +WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid, wmem_allocator_t *scope); /* add a UUID (dcerpc_init_uuid() will call this too) */ #define guids_add_uuid(uuid, name) guids_add_guid((const e_guid_t *) (uuid), (name)) /* try to get registered name for this UUID */ -#define guids_get_uuid_name(uuid) guids_get_guid_name((e_guid_t *) (uuid)) +#define guids_get_uuid_name(uuid, scope) guids_get_guid_name((e_guid_t *) (uuid), scope) /* resolve UUID to name (or if unknown to hex string) */ /* (if you need hex string only, use guid_to_str instead) */ diff --git a/plugins/epan/profinet/packet-dcom-cba-acco.c b/plugins/epan/profinet/packet-dcom-cba-acco.c index 1b5d4cc1cd..9026023d62 100644 --- a/plugins/epan/profinet/packet-dcom-cba-acco.c +++ b/plugins/epan/profinet/packet-dcom-cba-acco.c @@ -470,11 +470,11 @@ cba_pdev_find(packet_info *pinfo, const address *addr, e_guid_t *ipid) pdev = (cba_pdev_t *)interf->parent->private_data; if (pdev == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_pdev_find, "pdev_find: no pdev for IP:%s IPID:%s", - address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid)); + address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid, pinfo->pool)); } } else { expert_add_info_format(pinfo, NULL, &ei_cba_acco_pdev_find_unknown_interface, "pdev_find: unknown interface of IP:%s IPID:%s", - address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid)); + address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid, pinfo->pool)); pdev = NULL; }