From 29be26c4b3b387027abcab3c859643f0ee12e5cf Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Tue, 10 Feb 2015 07:09:56 +0100 Subject: FTAM: get rid of an evil global variable Fixes an ASAN failure reported by Alexis Change-Id: Id0ddad6451e22ffc53d42985e9b2071c7388d15b Reviewed-on: https://code.wireshark.org/review/7049 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Reviewed-by: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-ftam.c | 45 ++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-ftam.c b/epan/dissectors/packet-ftam.c index c7bcdb4a82..5739e91f59 100644 --- a/epan/dissectors/packet-ftam.c +++ b/epan/dissectors/packet-ftam.c @@ -55,7 +55,6 @@ void proto_reg_handoff_ftam(void); /* Initialize the protocol and registered fields */ static int proto_ftam = -1; -static const char *object_identifier_id; /* Declare the function to avoid a compiler warning */ static int dissect_ftam_OR_Set(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_); @@ -481,7 +480,7 @@ static int hf_ftam_Attribute_Names_read_l8gal_qualifiCatiOnS = -1; static int hf_ftam_Attribute_Names_read_private_use = -1; /*--- End of included file: packet-ftam-hf.c ---*/ -#line 57 "../../asn1/ftam/packet-ftam-template.c" +#line 56 "../../asn1/ftam/packet-ftam-template.c" /* Initialize the subtree pointers */ static gint ett_ftam = -1; @@ -652,7 +651,7 @@ static gint ett_ftam_Attribute_Names = -1; static gint ett_ftam_AE_title = -1; /*--- End of included file: packet-ftam-ett.c ---*/ -#line 61 "../../asn1/ftam/packet-ftam-template.c" +#line 60 "../../asn1/ftam/packet-ftam-template.c" static expert_field ei_ftam_zero_pdu = EI_INIT; @@ -862,7 +861,7 @@ dissect_ftam_FTAM_Quality_of_Service(gboolean implicit_tag _U_, tvbuff_t *tvb _U static int dissect_ftam_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference); return offset; } @@ -1309,7 +1308,7 @@ static const ber_choice_t FTAM_Regime_PDU_choice[] = { static int dissect_ftam_FTAM_Regime_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 92 "../../asn1/ftam/ftam.cnf" +#line 98 "../../asn1/ftam/ftam.cnf" gint branch_taken; offset = dissect_ber_choice(actx, tree, tvb, offset, @@ -1705,7 +1704,9 @@ dissect_ftam_Permitted_Actions_Attribute(gboolean implicit_tag _U_, tvbuff_t *tv static int dissect_ftam_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 75 "../../asn1/ftam/ftam.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + if (actx->external.direct_reference) { + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + } @@ -1908,7 +1909,7 @@ dissect_ftam_Concurrency_Access(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int dissect_ftam_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 87 "../../asn1/ftam/ftam.cnf" +#line 93 "../../asn1/ftam/ftam.cnf" /* XXX have no idea about this one */ @@ -1919,7 +1920,7 @@ dissect_ftam_AP_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ static int dissect_ftam_AE_qualifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 89 "../../asn1/ftam/ftam.cnf" +#line 95 "../../asn1/ftam/ftam.cnf" /* XXX have no idea about this one */ @@ -2064,7 +2065,7 @@ dissect_ftam_Extension_Set_Identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _ static int dissect_ftam_T_extension_attribute_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference); return offset; } @@ -2073,8 +2074,10 @@ dissect_ftam_T_extension_attribute_identifier(gboolean implicit_tag _U_, tvbuff_ static int dissect_ftam_T_extension_attribute(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 78 "../../asn1/ftam/ftam.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); +#line 80 "../../asn1/ftam/ftam.cnf" + if (actx->external.direct_reference) { + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + } @@ -3136,7 +3139,7 @@ static const ber_choice_t File_PDU_choice[] = { static int dissect_ftam_File_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 101 "../../asn1/ftam/ftam.cnf" +#line 107 "../../asn1/ftam/ftam.cnf" gint branch_taken; offset = dissect_ber_choice(actx, tree, tvb, offset, @@ -3440,7 +3443,7 @@ static const ber_choice_t Bulk_Data_PDU_choice[] = { static int dissect_ftam_Bulk_Data_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 110 "../../asn1/ftam/ftam.cnf" +#line 116 "../../asn1/ftam/ftam.cnf" gint branch_taken; offset = dissect_ber_choice(actx, tree, tvb, offset, @@ -3773,7 +3776,7 @@ dissect_ftam_Boolean_Pattern(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o static int dissect_ftam_T_attribute_extension_attribute_identifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference); return offset; } @@ -3782,8 +3785,10 @@ dissect_ftam_T_attribute_extension_attribute_identifier(gboolean implicit_tag _U static int dissect_ftam_T_extension_attribute_Pattern(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 84 "../../asn1/ftam/ftam.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); +#line 88 "../../asn1/ftam/ftam.cnf" + if (actx->external.direct_reference) { + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + } @@ -4702,7 +4707,7 @@ static const ber_choice_t FSM_PDU_choice[] = { static int dissect_ftam_FSM_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 119 "../../asn1/ftam/ftam.cnf" +#line 125 "../../asn1/ftam/ftam.cnf" gint branch_taken; offset = dissect_ber_choice(actx, tree, tvb, offset, @@ -4738,7 +4743,7 @@ dissect_ftam_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a /*--- End of included file: packet-ftam-fn.c ---*/ -#line 65 "../../asn1/ftam/packet-ftam-template.c" +#line 64 "../../asn1/ftam/packet-ftam-template.c" /* * Dissect FTAM unstructured text @@ -6463,7 +6468,7 @@ void proto_register_ftam(void) { NULL, HFILL }}, /*--- End of included file: packet-ftam-hfarr.c ---*/ -#line 129 "../../asn1/ftam/packet-ftam-template.c" +#line 128 "../../asn1/ftam/packet-ftam-template.c" }; /* List of subtrees */ @@ -6636,7 +6641,7 @@ void proto_register_ftam(void) { &ett_ftam_AE_title, /*--- End of included file: packet-ftam-ettarr.c ---*/ -#line 135 "../../asn1/ftam/packet-ftam-template.c" +#line 134 "../../asn1/ftam/packet-ftam-template.c" }; static ei_register_info ei[] = { { &ei_ftam_zero_pdu, { "ftam.zero_pdu", PI_PROTOCOL, PI_ERROR, "Internal error, zero-byte FTAM PDU", EXPFILL }}, -- cgit v1.2.3