diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-23 12:22:22 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-23 12:22:22 +0000 |
commit | 78f28015918dcce627f2b22964615aa9e6a36ee3 (patch) | |
tree | 673285219fa0a3c6396e649cc19d723222d9f9d9 /epan/dissectors/packet-ber.c | |
parent | d1304a66808c69cf2121680294ff570256f24347 (diff) |
Moved check for empty choice to make it work correctly.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23548 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r-- | epan/dissectors/packet-ber.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index cb68106b60..120534cabd 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -2560,6 +2560,13 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin #endif start_offset=offset; + if(tvb_length_remaining(tvb,offset) == 0) { + item = proto_tree_add_text(parent_tree, tvb, offset, 0, "BER Error: Empty choice 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 was found"); + return offset; + } + /* read header and len for choice field */ offset=get_ber_identifier(tvb, offset, &class, &pc, &tag); offset=get_ber_length(tvb, offset, &len, &ind); @@ -2637,13 +2644,6 @@ printf("CHOICE testing potential subdissector class[%p]:%d:(expected)%d tag:%d: } } - if(length == 0) { - item = proto_tree_add_text(tree, tvb, hoffset, 0, "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 hoffset; - } - length_remaining=tvb_length_remaining(tvb, hoffset); if(length_remaining>length) length_remaining=length; @@ -2794,6 +2794,13 @@ printf("CHOICE dissect_ber_old_choice(%s) entered len:%d\n",name,tvb_length_rema #endif start_offset=offset; + if(tvb_length_remaining(tvb,offset) == 0) { + item = proto_tree_add_text(parent_tree, tvb, offset, 0, "BER Error: Empty choice 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 was found"); + return offset; + } + /* read header and len for choice field */ offset=get_ber_identifier(tvb, offset, &class, &pc, &tag); offset=get_ber_length(tvb, offset, &len, &ind); @@ -2871,13 +2878,6 @@ printf("CHOICE testing potential subdissector class[%p]:%d:(expected)%d tag:%d: } } - if(length == 0) { - item = proto_tree_add_text(tree, tvb, hoffset, 0, "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 hoffset; - } - length_remaining=tvb_length_remaining(tvb, hoffset); if(length_remaining>length) length_remaining=length; |