aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ber.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r--epan/dissectors/packet-ber.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index fbd4c0eaaf..d70fdfb4ba 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -2560,6 +2560,14 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin
offset=get_ber_length(tvb, offset, &len, &ind);
end_offset = offset + len ;
+ /* do not stop processing if the length has the (illegal) value of zero */
+ if(len == 0) {
+ item = proto_tree_add_text(tree, tvb, offset, len, "BER Error: Empty choice field was found");
+ proto_item_set_expert_flags(item, PI_MALFORMED, PI_WARN);
+ expert_add_info_format(actx->pinfo, item, PI_MALFORMED, PI_WARN, "BER Error: Empty choice field was found");
+ return offset;
+ }
+
/* Some sanity checks.
* The hf field passed to us MUST be an integer type
*/
@@ -2786,6 +2794,14 @@ printf("CHOICE dissect_ber_old_choice(%s) entered len:%d\n",name,tvb_length_rema
offset=get_ber_length(tvb, offset, &len, &ind);
end_offset = offset + len ;
+ /* do not stop processing if the length has the (illegal) value of zero */
+ if(len == 0) {
+ item = proto_tree_add_text(tree, tvb, offset, len, "BER Error: Empty choice field was found");
+ proto_item_set_expert_flags(item, PI_MALFORMED, PI_WARN);
+ expert_add_info_format(actx->pinfo, item, PI_MALFORMED, PI_WARN, "BER Error: Empty choice field was found");
+ return offset;
+ }
+
/* Some sanity checks.
* The hf field passed to us MUST be an integer type
*/