diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-02-13 17:58:25 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-02-17 20:28:45 +0000 |
commit | fd870e34e865e5d8e1114b8b6d9394355989a617 (patch) | |
tree | 2fce15a4594b69153fe8e54c4a2807be1f3c62ed /asn1 | |
parent | edf05db347d70c25bdc70247a37e8b95045f5dc6 (diff) |
CMIP: get rid of some evil global variables
Fixes an ASAN failure reported by Alexis
Note that some global variables remain as I do not know enough on this protocol to safely remove them
Change-Id: If392a8f09ef2fc2f2d46871a71149e29fe5e292c
Reviewed-on: https://code.wireshark.org/review/7099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/cmip/cmip.cnf | 38 | ||||
-rw-r--r-- | asn1/cmip/packet-cmip-template.c | 13 |
2 files changed, 20 insertions, 31 deletions
diff --git a/asn1/cmip/cmip.cnf b/asn1/cmip/cmip.cnf index 37fe3a5910..4a9eccc89a 100644 --- a/asn1/cmip/cmip.cnf +++ b/asn1/cmip/cmip.cnf @@ -263,28 +263,34 @@ RejectProblem col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "Reject "); #.END -#.FN_BODY AttributeId/globalForm FN_VARIANT = _str VAL_PTR = &attribute_identifier_id - attributeform = ATTRIBUTE_GLOBAL_FORM; +#.FN_BODY AttributeId/globalForm FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference %(DEFAULT_BODY)s + actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE; -#.FN_BODY AttributeId/localForm VAL_PTR = &attribute_local_id - attributeform = ATTRIBUTE_LOCAL_FORM; +#.FN_BODY AttributeId/localForm VAL_PTR = &actx->external.indirect_reference %(DEFAULT_BODY)s + actx->external.indirect_ref_present = TRUE; #.FN_BODY Attribute/value - if(attributeform==ATTRIBUTE_GLOBAL_FORM){ - offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); - } else if (dissector_try_uint(attribute_id_dissector_table, attribute_local_id, tvb, actx->pinfo, tree)) { + if(actx->external.direct_ref_present){ + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); + } else if (actx->external.indirect_ref_present && + dissector_try_uint(attribute_id_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { offset=dissect_unknown_ber(actx->pinfo, tvb, offset, tree); } #.FN_PARS AttributeValueAssertion/id - FN_VARIANT = _str VAL_PTR = &attributevalueassertion_id + FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference + +#.FN_FTR AttributeValueAssertion/id + actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE; #.FN_BODY AttributeValueAssertion/value - offset=call_ber_oid_callback(attributevalueassertion_id, tvb, offset, actx->pinfo, tree, actx->private_data); + if (actx->external.direct_ref_present) { + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); + } #.FN_BODY Invoke/argument switch(opcode){ @@ -427,13 +433,8 @@ RejectProblem break; } -#.FN_HDR ObjectClass/globalForm - objectclassform = OBJECTCLASS_GLOBAL_FORM; #.FN_PARS ObjectClass/globalForm - FN_VARIANT = _str VAL_PTR = &objectclass_identifier_id - -#.FN_HDR ObjectClass/localForm - objectclassform = OBJECTCLASS_LOCAL_FORM; + FN_VARIANT = _str #.FN_PARS ActionTypeId/globalForm FN_VARIANT = _str HF_INDEX = hf_cmip_actionType_OID VAL_PTR = &object_identifier_id @@ -451,9 +452,10 @@ RejectProblem offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY SetArgument/modificationList/_item/attributeValue - if(attributeform==ATTRIBUTE_GLOBAL_FORM){ - offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, NULL); - } else if (dissector_try_uint(attribute_id_dissector_table, attribute_local_id, tvb, actx->pinfo, tree)) { + if(actx->external.direct_ref_present){ + offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + } else if (actx->external.indirect_ref_present && + dissector_try_uint(attribute_id_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { offset=dissect_unknown_ber(actx->pinfo, tvb, offset, tree); diff --git a/asn1/cmip/packet-cmip-template.c b/asn1/cmip/packet-cmip-template.c index e3da507fa5..7dd27fc98c 100644 --- a/asn1/cmip/packet-cmip-template.c +++ b/asn1/cmip/packet-cmip-template.c @@ -75,21 +75,8 @@ static int opcode_type; #define OPCODE_RETURN_ERROR 3 #define OPCODE_REJECT 4 -static int attributeform; -#define ATTRIBUTE_LOCAL_FORM 0 -#define ATTRIBUTE_GLOBAL_FORM 1 -static int attribute_local_id; -static const char *attribute_identifier_id; - -static const char *attributevalueassertion_id; - static const char *object_identifier_id; -static int objectclassform; -#define OBJECTCLASS_LOCAL_FORM 0 -#define OBJECTCLASS_GLOBAL_FORM 1 -static const char *objectclass_identifier_id; - #include "packet-cmip-val.h" #include "packet-cmip-fn.c" |