diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-09 22:23:44 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-09 22:23:44 +0000 |
commit | 79fa0d0a3fa8ebb91fac92fda1274957fc55bcd4 (patch) | |
tree | 9a714a0dfd512884ae08640817e2783d528d0bf3 /asn1 | |
parent | e3c369eb6786e8f17e3e8ce6da027012511566b8 (diff) |
Reject the packet if data is NULL without doing anything else.
Note: We *might* want to do _something_ but that _something_ should be well-defined and consistent across all dissectors. Previously, some dissectors called proto_tree_add_text() to add some error message text to the tree, while others called DISSECTOR_ASSERT().
svn path=/trunk/; revision=53895
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/disp/packet-disp-template.c | 14 | ||||
-rw-r--r-- | asn1/dop/packet-dop-template.c | 16 | ||||
-rw-r--r-- | asn1/dsp/packet-dsp-template.c | 16 | ||||
-rw-r--r-- | asn1/p1/packet-p1-template.c | 16 | ||||
-rw-r--r-- | asn1/ros/packet-ros-template.c | 15 | ||||
-rw-r--r-- | asn1/rtse/packet-rtse-template.c | 16 |
6 files changed, 29 insertions, 64 deletions
diff --git a/asn1/disp/packet-disp-template.c b/asn1/disp/packet-disp-template.c index 9245d3c938..0924ee9657 100644 --- a/asn1/disp/packet-disp-template.c +++ b/asn1/disp/packet-disp-template.c @@ -87,18 +87,12 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d const char *disp_op_name; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - - /* do we have operation information from the ROS dissector? */ - if( data == NULL ){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error: can't get operation information from ROS dissector."); - } + /* do we have operation information from the ROS dissector */ + if (data == NULL) return 0; - } + session = (struct SESSION_DATA_STRUCTURE*)data; - session = ((struct SESSION_DATA_STRUCTURE*)data); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); asn1_ctx.private_data = session; diff --git a/asn1/dop/packet-dop-template.c b/asn1/dop/packet-dop-template.c index 0276702d10..3ce204710b 100644 --- a/asn1/dop/packet-dop-template.c +++ b/asn1/dop/packet-dop-template.c @@ -129,18 +129,12 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da const char *dop_op_name; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - - /* do we have operation information from the ROS dissector? */ - if( data == NULL ){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error: can't get operation information from ROS dissector."); - } - return 0; - } + /* do we have operation information from the ROS dissector? */ + if (data == NULL) + return 0; + session = (struct SESSION_DATA_STRUCTURE*)data; - session = ( (struct SESSION_DATA_STRUCTURE*)data ); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_dop); diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c index fa4f9becd5..3a15d88504 100644 --- a/asn1/dsp/packet-dsp-template.c +++ b/asn1/dsp/packet-dsp-template.c @@ -81,18 +81,12 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da const char *dsp_op_name; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - - /* do we have operation information from the ROS dissector? */ - if( data == NULL ){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error: can't get operation information from ROS dissector."); - } - return 0; - } + /* do we have operation information from the ROS dissector? */ + if (data == NULL) + return 0; + session = (struct SESSION_DATA_STRUCTURE*)data; - session = ( (struct SESSION_DATA_STRUCTURE*)data); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_dsp); diff --git a/asn1/p1/packet-p1-template.c b/asn1/p1/packet-p1-template.c index bd73ccdabb..10ca12e484 100644 --- a/asn1/p1/packet-p1-template.c +++ b/asn1/p1/packet-p1-template.c @@ -235,19 +235,13 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - /* save parent_tree so subdissectors can create new top nodes */ - p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE); - - /* do we have operation information from the ROS dissector? */ - if( data == NULL ){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error: can't get operation information from ROS dissector."); - } + /* do we have operation information from the ROS dissector? */ + if (data == NULL) return 0; - } + session = (struct SESSION_DATA_STRUCTURE*)data; - session = ( (struct SESSION_DATA_STRUCTURE*)data ); + /* save parent_tree so subdissectors can create new top nodes */ + p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE); asn1_ctx.private_data = session; diff --git a/asn1/ros/packet-ros-template.c b/asn1/ros/packet-ros-template.c index 35dfad34da..967916d541 100644 --- a/asn1/ros/packet-ros-template.c +++ b/asn1/ros/packet-ros-template.c @@ -384,19 +384,14 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + /* do we have application context from the acse dissector? */ + if (data == NULL) + return 0; + asn1_ctx.private_data = data; + /* save parent_tree so subdissectors can create new top nodes */ top_tree=parent_tree; - /* do we have application context from the acse dissector? */ - if( !data){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error:can't get application context from ACSE dissector."); - } - return 0; - } - - asn1_ctx.private_data = data; conversation = find_or_create_conversation(pinfo); /* diff --git a/asn1/rtse/packet-rtse-template.c b/asn1/rtse/packet-rtse-template.c index 83386f5d6e..27c26b854b 100644 --- a/asn1/rtse/packet-rtse-template.c +++ b/asn1/rtse/packet-rtse-template.c @@ -207,19 +207,13 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - /* save parent_tree so subdissectors can create new top nodes */ - top_tree=parent_tree; - - /* do we have application context from the acse dissector? */ - if( data == NULL ){ - if(parent_tree){ - proto_tree_add_text(parent_tree, tvb, offset, -1, - "Internal error:can't get application context from ACSE dissector."); - } + /* do we have application context from the acse dissector? */ + if (data == NULL) return 0; - } + session = (struct SESSION_DATA_STRUCTURE*)data; - session = ( (struct SESSION_DATA_STRUCTURE*)data); + /* save parent_tree so subdissectors can create new top nodes */ + top_tree=parent_tree; asn1_ctx.private_data = session; |