diff options
author | Evan Huus <eapache@gmail.com> | 2015-08-09 10:36:18 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-08-09 17:14:08 +0000 |
commit | 2ef3cdaeb0f6500e25cab029ec5eeb2ef7bcfccf (patch) | |
tree | 3bd29ee07244e952ecd4186f0010247fe59c9c49 /asn1 | |
parent | b3207c0384b23c6483289c7ff60d99a9a5a8b683 (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 'asn1')
-rw-r--r-- | asn1/t124/packet-t124-template.c | 8 | ||||
-rw-r--r-- | asn1/t124/t124.cnf | 14 |
2 files changed, 9 insertions, 13 deletions
diff --git a/asn1/t124/packet-t124-template.c b/asn1/t124/packet-t124-template.c index 87752ab2a3..63134698b0 100644 --- a/asn1/t124/packet-t124-template.c +++ b/asn1/t124/packet-t124-template.c @@ -61,8 +61,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; @@ -153,8 +151,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 @@ -170,8 +166,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; diff --git a/asn1/t124/t124.cnf b/asn1/t124/t124.cnf index e8ac286e4a..ffafb9e1f0 100644 --- a/asn1/t124/t124.cnf +++ b/asn1/t124/t124.cnf @@ -146,17 +146,17 @@ RegistryAllocateHandleResponse/result AllocateHandleResponseResult #.END #.FN_BODY UserData/_item/value VAL_PTR = &next_tvb - tvbuff_t *next_tvb = NULL; - guint8 *ns = NULL; + tvbuff_t *next_tvb = NULL; + tvbuff_t *t124NSIdentifier = (tvbuff_t*)actx->private_data; + guint8 *ns = NULL; %(DEFAULT_BODY)s - 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); } } @@ -208,10 +208,10 @@ RegistryAllocateHandleResponse/result AllocateHandleResponseResult #.END #.FN_PARS Key/object - FN_VARIANT = _str VAL_PTR = &t124Identifier + FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference #.FN_PARS H221NonStandardIdentifier - VAL_PTR = &t124NSIdentifier + VAL_PTR = (tvbuff_t**)&actx->private_data #.FN_BODY H221NonStandardIdentifier |