aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-t124.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2015-08-09 10:36:18 -0400
committerEvan Huus <eapache@gmail.com>2015-08-09 17:14:08 +0000
commit2ef3cdaeb0f6500e25cab029ec5eeb2ef7bcfccf (patch)
tree3bd29ee07244e952ecd4186f0010247fe59c9c49 /epan/dissectors/packet-t124.c
parentb3207c0384b23c6483289c7ff60d99a9a5a8b683 (diff)
t124: kill evil global variables
Bug: 11430 Change-Id: Ia4196ff693806dc1e20eae4075dda7dfe272c5b6 Reviewed-on: https://code.wireshark.org/review/9941 Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-t124.c')
-rw-r--r--epan/dissectors/packet-t124.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/epan/dissectors/packet-t124.c b/epan/dissectors/packet-t124.c
index d70375455e..a67133e967 100644
--- a/epan/dissectors/packet-t124.c
+++ b/epan/dissectors/packet-t124.c
@@ -297,8 +297,6 @@ static int hf_t124_DomainMCSPDU_PDU = -1;
static guint32 channelId = -1;
-static const char *t124Identifier = NULL; /* extensions identifier */
-static tvbuff_t *t124NSIdentifier = NULL; /* extensions non-standard identifier */
static dissector_table_t t124_ns_dissector_table=NULL;
static dissector_table_t t124_sd_dissector_table=NULL;
@@ -408,7 +406,7 @@ static gint ett_t124_TokenTestConfirm = -1;
static gint ett_t124_DomainMCSPDU = -1;
/*--- End of included file: packet-t124-ett.c ---*/
-#line 70 "../../asn1/t124/packet-t124-template.c"
+#line 68 "../../asn1/t124/packet-t124-template.c"
/*--- Included file: packet-t124-fn.c ---*/
@@ -439,7 +437,7 @@ dissect_t124_H221NonStandardIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_c
#line 217 "../../asn1/t124/t124.cnf"
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
- 4, 255, FALSE, &t124NSIdentifier);
+ 4, 255, FALSE, (tvbuff_t**)&actx->private_data);
@@ -452,7 +450,7 @@ dissect_t124_H221NonStandardIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_c
static int
dissect_t124_T_object(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_per_object_identifier_str(tvb, offset, actx, tree, hf_index, &t124Identifier);
+ offset = dissect_per_object_identifier_str(tvb, offset, actx, tree, hf_index, &actx->external.direct_reference);
return offset;
}
@@ -572,19 +570,19 @@ dissect_t124_ExtraDiallingString(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *
static int
dissect_t124_T_value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 149 "../../asn1/t124/t124.cnf"
- tvbuff_t *next_tvb = NULL;
- guint8 *ns = NULL;
+ tvbuff_t *next_tvb = NULL;
+ tvbuff_t *t124NSIdentifier = (tvbuff_t*)actx->private_data;
+ guint8 *ns = NULL;
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, FALSE, &next_tvb);
- if(next_tvb) {
+ if(next_tvb && t124NSIdentifier) {
- ns = tvb_get_string_enc(NULL, t124NSIdentifier, 0, tvb_reported_length(t124NSIdentifier), ENC_ASCII|ENC_NA);
+ ns = tvb_get_string_enc(wmem_packet_scope(), t124NSIdentifier, 0, tvb_reported_length(t124NSIdentifier), ENC_ASCII|ENC_NA);
if(ns != NULL) {
dissector_try_string(t124_ns_dissector_table, ns, next_tvb, actx->pinfo, top_tree, NULL);
- g_free(ns);
}
}
@@ -2878,7 +2876,7 @@ dissect_t124_DomainMCSPDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U
/*--- End of included file: packet-t124-fn.c ---*/
-#line 72 "../../asn1/t124/packet-t124-template.c"
+#line 70 "../../asn1/t124/packet-t124-template.c"
static const per_sequence_t t124Heur_sequence[] = {
{ &hf_t124_t124Identifier , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_t124_Key },
@@ -2963,8 +2961,6 @@ dissect_t124_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
- t124Identifier = NULL;
-
/*
* We must catch all the "ran past the end of the packet" exceptions
* here and, if we catch one, just return FALSE. It's too painful
@@ -2980,8 +2976,8 @@ dissect_t124_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo
failed = TRUE;
} ENDTRY;
- if (!failed && ((t124Identifier != NULL) &&
- (strcmp(t124Identifier, "0.0.20.124.0.1") == 0))) {
+ if (!failed && ((asn1_ctx.external.direct_reference != NULL) &&
+ (strcmp(asn1_ctx.external.direct_reference, "0.0.20.124.0.1") == 0))) {
dissect_t124(tvb, pinfo, parent_tree);
return TRUE;
@@ -3900,7 +3896,7 @@ void proto_register_t124(void) {
NULL, HFILL }},
/*--- End of included file: packet-t124-hfarr.c ---*/
-#line 201 "../../asn1/t124/packet-t124-template.c"
+#line 197 "../../asn1/t124/packet-t124-template.c"
};
/* List of subtrees */
@@ -4013,7 +4009,7 @@ void proto_register_t124(void) {
&ett_t124_DomainMCSPDU,
/*--- End of included file: packet-t124-ettarr.c ---*/
-#line 208 "../../asn1/t124/packet-t124-template.c"
+#line 204 "../../asn1/t124/packet-t124-template.c"
};
/* Register protocol */