aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-01-17 14:11:29 -0500
committerMichael Mann <mmann78@netscape.net>2015-01-19 02:52:11 +0000
commite333e4c90f0aca41b0a56cef22fd80d0b0e73e14 (patch)
tree0d90a0e8561d6e4cf1361d56629e649af655d40d /epan/dissectors
parent59155d1d1c40a979d5f5040e4df35ee72dadbb9c (diff)
Convert OID APIs to use wmem.
There are a few oid functions that are only called in oids_test.c. I'll presume the APIs are used in proprietary dissectors rather than just remove them. Change-Id: I4595e00f93bf9ab8cf2493fe0432b91960f55a3f Reviewed-on: https://code.wireshark.org/review/6592 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-ber.c6
-rw-r--r--epan/dissectors/packet-c1222.c3
-rw-r--r--epan/dissectors/packet-cdt.c2
-rw-r--r--epan/dissectors/packet-cms.c6
-rw-r--r--epan/dissectors/packet-cops.c6
-rw-r--r--epan/dissectors/packet-dop.c2
-rw-r--r--epan/dissectors/packet-ldap.c6
-rw-r--r--epan/dissectors/packet-p1.c6
-rw-r--r--epan/dissectors/packet-p22.c2
-rw-r--r--epan/dissectors/packet-per.c4
-rw-r--r--epan/dissectors/packet-pkcs12.c4
-rw-r--r--epan/dissectors/packet-pres.c2
-rw-r--r--epan/dissectors/packet-snmp.c18
-rw-r--r--epan/dissectors/packet-x509af.c4
-rw-r--r--epan/dissectors/packet-x509if.c4
15 files changed, 38 insertions, 37 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 6784dc0048..09679f238f 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -3201,11 +3201,11 @@ printf("OBJECT IDENTIFIER dissect_ber_any_oid(%s) entered\n", name);
if ((is_absolute && hfi->type == FT_OID) || (!is_absolute && hfi->type == FT_REL_OID)) {
actx->created_item = proto_tree_add_item(tree, hf_id, tvb, offset, len, ENC_BIG_ENDIAN);
} else if (IS_FT_STRING(hfi->type)) {
- str = oid_encoded2string(tvb_get_ptr(tvb, offset, len), len);
+ str = oid_encoded2string(wmem_packet_scope(), tvb_get_ptr(tvb, offset, len), len);
actx->created_item = proto_tree_add_string(tree, hf_id, tvb, offset, len, str);
if (actx->created_item) {
/* see if we know the name of this oid */
- name = oid_resolved_from_encoded(tvb_get_ptr(tvb, offset, len), len);
+ name = oid_resolved_from_encoded(wmem_packet_scope(), tvb_get_ptr(tvb, offset, len), len);
if (name) {
proto_item_append_text(actx->created_item, " (%s)", name);
}
@@ -3230,7 +3230,7 @@ dissect_ber_any_oid_str(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tre
if (value_stringx) {
if (value_tvb && (length = tvb_reported_length(value_tvb))) {
- *value_stringx = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length);
+ *value_stringx = oid_encoded2string(wmem_packet_scope(), tvb_get_ptr(value_tvb, 0, length), length);
} else {
*value_stringx = "";
}
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c
index aa864c4605..dc0b4480ef 100644
--- a/epan/dissectors/packet-c1222.c
+++ b/epan/dissectors/packet-c1222.c
@@ -2058,9 +2058,10 @@ proto_reg_handoff_c1222(void)
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;
}
- c1222_baseoid_len = oid_string2encoded(c1222_baseoid_str, &temp);
+ c1222_baseoid_len = oid_string2encoded(NULL, c1222_baseoid_str, &temp);
c1222_baseoid = (guint8 *)wmem_realloc(wmem_epan_scope(), c1222_baseoid, c1222_baseoid_len);
memcpy(c1222_baseoid, temp, c1222_baseoid_len);
+ wmem_free(NULL, temp);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/epan/dissectors/packet-cdt.c b/epan/dissectors/packet-cdt.c
index 85bdb1d014..09873bea8e 100644
--- a/epan/dissectors/packet-cdt.c
+++ b/epan/dissectors/packet-cdt.c
@@ -201,7 +201,7 @@ dissect_cdt_T_contentType_OID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &obj_id);
if (obj_id) {
- const char *name = oid_resolved_from_string (obj_id);
+ const char *name = oid_resolved_from_string (wmem_packet_scope(), obj_id);
if (!name) {
name = obj_id;
diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c
index 8a6fda0957..3af16d65c9 100644
--- a/epan/dissectors/packet-cms.c
+++ b/epan/dissectors/packet-cms.c
@@ -338,7 +338,7 @@ dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
if(object_identifier_id) {
- name = oid_resolved_from_string(object_identifier_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id);
proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id);
}
@@ -466,7 +466,7 @@ dissect_cms_T_attrType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
if(object_identifier_id) {
- name = oid_resolved_from_string(object_identifier_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id);
proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id);
}
@@ -1643,7 +1643,7 @@ dissect_cms_T_capability(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
if(object_identifier_id) {
- name = oid_resolved_from_string(object_identifier_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id);
proto_item_append_text(tree, " %s", name ? name : object_identifier_id);
cap_tree = tree;
}
diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c
index b34a09d3fe..2d619c678e 100644
--- a/epan/dissectors/packet-cops.c
+++ b/epan/dissectors/packet-cops.c
@@ -1579,7 +1579,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
encoid_len = tvb_length_remaining(oid_tvb,0);
if (encoid_len > 0) {
encoid = (guint8*)tvb_memdup(wmem_packet_scope(),oid_tvb,0,encoid_len);
- (*pprid_subids_len) = oid_encoded2subid(encoid, encoid_len, pprid_subids);
+ (*pprid_subids_len) = oid_encoded2subid(wmem_packet_scope(), encoid, encoid_len, pprid_subids);
}
}
break;
@@ -1610,9 +1610,9 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3
if (*pprid_subids) {
/* Never tested this branch */
subids_len = redecode_oid(*pprid_subids, *pprid_subids_len, encoid, encoid_len, &subids);
- encoid_len = oid_subid2encoded(subids_len, subids, &encoid);
+ encoid_len = oid_subid2encoded(wmem_packet_scope(), subids_len, subids, &encoid);
} else {
- subids_len = oid_encoded2subid(encoid, encoid_len, &subids);
+ subids_len = oid_encoded2subid(wmem_packet_scope(), encoid, encoid_len, &subids);
}
proto_tree_add_oid(asn_tree,hf_cops_prid_oid,tvb,offset,encoid_len,encoid);
diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c
index 42c1007b00..84111ca9ba 100644
--- a/epan/dissectors/packet-dop.c
+++ b/epan/dissectors/packet-dop.c
@@ -357,7 +357,7 @@ static void append_oid(packet_info *pinfo, const char *oid)
{
const char *name = NULL;
- name = oid_resolved_from_string(oid);
+ name = oid_resolved_from_string(wmem_packet_scope(), oid);
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name ? name : oid);
}
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 430675d8bf..74ed9075e1 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -2860,7 +2860,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
return offset;
object_identifier_id = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA);
- name = oid_resolved_from_string(object_identifier_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id);
if(name){
proto_item_append_text(actx->created_item, " (%s)", name);
@@ -3054,7 +3054,7 @@ dissect_ldap_T_intermediateResponse_responseValue(gboolean implicit_tag _U_, tvb
#line 759 "../../asn1/ldap/ldap.cnf"
if(ldm_tree && object_identifier_id) {
proto_item_set_text(ldm_tree, "%s %s", "IntermediateResponse", object_identifier_id);
- name = oid_resolved_from_string(object_identifier_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id);
if(name)
proto_item_append_text(ldm_tree, " (%s)", name);
}
@@ -4608,7 +4608,7 @@ dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
return;
}
- oidname=oid_resolved_from_string(oid);
+ oidname=oid_resolved_from_string(wmem_packet_scope(), oid);
if(oidname){
proto_tree_add_string_format_value(tree, hf_ldap_oid, tvb, 0, tvb_reported_length(tvb), oid, "%s (%s)",oid,oidname);
diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c
index aa8891faed..38c32c694b 100644
--- a/epan/dissectors/packet-p1.c
+++ b/epan/dissectors/packet-p1.c
@@ -1242,7 +1242,7 @@ dissect_p1_SecurityCategoryValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
if (actx->external.direct_reference) {
offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data);
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference);
} else {
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, tree);
@@ -2540,7 +2540,7 @@ dissect_p1_ExtendedContentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
if(ctx->content_type_id) {
- name = oid_resolved_from_string(ctx->content_type_id);
+ name = oid_resolved_from_string(wmem_packet_scope(), ctx->content_type_id);
if(!name) name = ctx->content_type_id;
@@ -3057,7 +3057,7 @@ dissect_p1_ExtensionValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
}
} else if (actx->external.direct_ref_present) {
offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data);
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference);
}
diff --git a/epan/dissectors/packet-p22.c b/epan/dissectors/packet-p22.c
index f0670d3f0e..2fb3a0aa24 100644
--- a/epan/dissectors/packet-p22.c
+++ b/epan/dissectors/packet-p22.c
@@ -1035,7 +1035,7 @@ dissect_p22_T_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference);
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index 3860305f19..ca14c4a6a0 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -964,7 +964,7 @@ dissect_per_any_oid(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree
if ((is_absolute && hfi->type == FT_OID) || (is_absolute && hfi->type == FT_REL_OID)) {
actx->created_item = proto_tree_add_item(tree, hf_index, val_tvb, 0, length, ENC_BIG_ENDIAN);
} else if (IS_FT_STRING(hfi->type)) {
- str = oid_encoded2string(tvb_get_ptr(val_tvb, 0, length), length);
+ str = oid_encoded2string(wmem_packet_scope(), tvb_get_ptr(val_tvb, 0, length), length);
actx->created_item = proto_tree_add_string(tree, hf_index, val_tvb, 0, length, str);
} else {
DISSECTOR_ASSERT_NOT_REACHED();
@@ -1000,7 +1000,7 @@ dissect_per_any_oid_str(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_t
if (value_stringx) {
if (value_tvb && (length = tvb_captured_length(value_tvb))) {
- *value_stringx = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length);
+ *value_stringx = oid_encoded2string(wmem_packet_scope(), tvb_get_ptr(value_tvb, 0, length), length);
} else {
*value_stringx = "";
}
diff --git a/epan/dissectors/packet-pkcs12.c b/epan/dissectors/packet-pkcs12.c
index be24d87201..1bded351d6 100644
--- a/epan/dissectors/packet-pkcs12.c
+++ b/epan/dissectors/packet-pkcs12.c
@@ -178,7 +178,7 @@ static void append_oid(proto_tree *tree, const char *oid)
{
const char *name = NULL;
- name = oid_resolved_from_string(oid);
+ name = oid_resolved_from_string(wmem_packet_scope(), oid);
proto_item_append_text(tree, " (%s)", name ? name : oid);
}
@@ -461,7 +461,7 @@ int PBE_decrypt_data(const char *object_identifier_id_param, tvbuff_t *encrypted
tvb_set_free_cb(clear_tvb, g_free);
name = g_string_new("");
- oidname = oid_resolved_from_string(object_identifier_id_param);
+ oidname = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id_param);
g_string_printf(name, "Decrypted %s", oidname ? oidname : object_identifier_id_param);
/* add it as a new source */
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index 7e914841fc..a089d0bebb 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -445,7 +445,7 @@ dissect_pres_Presentation_context_identifier(gboolean implicit_tag _U_, tvbuff_t
oid = find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier);
- if(oid && (name = oid_resolved_from_string(oid))) {
+ if(oid && (name = oid_resolved_from_string(wmem_packet_scope(), oid))) {
proto_item_append_text(actx->created_item, " (%s)", name);
}
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index bc5373272e..7499c575ea 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -709,21 +709,21 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
/* fetch ObjectName and its relative oid_info */
oid_bytes = (guint8*)tvb_memdup(wmem_packet_scope(), tvb, name_offset, name_len);
- oid_info = oid_get_from_encoded(oid_bytes, name_len, &subids, &oid_matched, &oid_left);
+ oid_info = oid_get_from_encoded(wmem_packet_scope(), oid_bytes, name_len, &subids, &oid_matched, &oid_left);
add_oid_debug_subtree(oid_info,pt_name);
if (!subids) {
proto_item* pi;
- repr = oid_encoded2string(oid_bytes, name_len);
+ repr = oid_encoded2string(wmem_packet_scope(), oid_bytes, name_len);
pt = proto_tree_add_subtree_format(pt_name,tvb, 0, 0, ett_decoding_error, &pi, "invalid oid: %s", repr);
expert_add_info_format(actx->pinfo, pi, &ei_snmp_invalid_oid, "invalid oid: %s", repr);
return dissect_unknown_ber(actx->pinfo, tvb, name_offset, pt);
}
if (oid_matched+oid_left) {
- oid_string = oid_subid2string(subids,oid_matched+oid_left);
+ oid_string = oid_subid2string(wmem_packet_scope(), subids,oid_matched+oid_left);
}
if (ber_class == BER_CLASS_CON) {
@@ -854,7 +854,7 @@ show_oid_index:
goto indexing_done;
}
- suboid_buf_len = oid_subid2encoded(suboid_len, suboid, &suboid_buf);
+ suboid_buf_len = oid_subid2encoded(wmem_packet_scope(), suboid_len, suboid, &suboid_buf);
DISSECTOR_ASSERT(suboid_buf_len);
@@ -1122,13 +1122,13 @@ set_label:
if (oid_info && oid_info->name) {
if (oid_left >= 1) {
repr = wmem_strdup_printf(wmem_packet_scope(), "%s.%s (%s)", oid_info->name,
- oid_subid2string(&(subids[oid_matched]),oid_left),
- oid_subid2string(subids,oid_matched+oid_left));
+ oid_subid2string(wmem_packet_scope(), &(subids[oid_matched]),oid_left),
+ oid_subid2string(wmem_packet_scope(), subids,oid_matched+oid_left));
info_oid = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", oid_info->name,
- oid_subid2string(&(subids[oid_matched]),oid_left));
+ oid_subid2string(wmem_packet_scope(), &(subids[oid_matched]),oid_left));
} else {
repr = wmem_strdup_printf(wmem_packet_scope(), "%s (%s)", oid_info->name,
- oid_subid2string(subids,oid_matched));
+ oid_subid2string(wmem_packet_scope(), subids,oid_matched));
info_oid = oid_info->name;
}
} else if (oid_string) {
@@ -1977,7 +1977,7 @@ dissect_snmp_EnterpriseOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
if (display_oid && enterprise_oid) {
- name = oid_resolved_from_string(enterprise_oid);
+ name = oid_resolved_from_string(wmem_packet_scope(), enterprise_oid);
if (name) {
col_append_fstr (actx->pinfo->cinfo, COL_INFO, " %s", name);
}
diff --git a/epan/dissectors/packet-x509af.c b/epan/dissectors/packet-x509af.c
index 5d664ad0ae..e3cabe6295 100644
--- a/epan/dissectors/packet-x509af.c
+++ b/epan/dissectors/packet-x509af.c
@@ -218,7 +218,7 @@ dissect_x509af_T_algorithmId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
algorithm_id = actx->external.direct_reference;
if(actx->external.direct_reference) {
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference);
}
@@ -376,7 +376,7 @@ dissect_x509af_T_extnId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
if(actx->external.direct_reference) {
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference);
}
diff --git a/epan/dissectors/packet-x509if.c b/epan/dissectors/packet-x509if.c
index c4e727342c..1d51148173 100644
--- a/epan/dissectors/packet-x509if.c
+++ b/epan/dissectors/packet-x509if.c
@@ -728,7 +728,7 @@ dissect_x509if_T_type_02(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
if(actx->external.direct_reference) {
/* see if we can find a nice name */
- name = oid_resolved_from_string(actx->external.direct_reference);
+ name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);
if(!name) name = actx->external.direct_reference;
if(last_rdn) { /* append it to the RDN */
@@ -801,7 +801,7 @@ dissect_x509if_T_atadv_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
last_ava = (char *)wmem_alloc(wmem_packet_scope(), MAX_AVA_STR_LEN);
}
- if(!(name = oid_resolved_from_string(actx->external.direct_reference)))
+ if(!(name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference)))
name = actx->external.direct_reference;
g_snprintf(last_ava, MAX_AVA_STR_LEN, "%s %s %s", name, fmt, value);