diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-06-30 09:09:18 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-06-30 09:09:18 +0000 |
commit | b5efaaf6dce3d02d143f9f2a04c2098152a9cea7 (patch) | |
tree | 837f33f8e252894dbda6a4d6a92b33eecf8056c2 /epan/dissectors/packet-ber.c | |
parent | ac1136c60e94ea195247cb382d94d1cc4c9b828c (diff) |
Added expert info for illegal bitstring padding and when bits are set
in the padded area.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33382 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ber.c')
-rw-r--r-- | epan/dissectors/packet-ber.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 5c296bc58f..33b1417c71 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -4241,7 +4241,11 @@ int dissect_ber_constrained_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, p proto_tree_add_item(parent_tree, hf_ber_bitstring_empty, tvb, offset, 1, FALSE); } else { /* padding */ - proto_tree_add_item(parent_tree, hf_ber_bitstring_padding, tvb, offset, 1, FALSE); + proto_item *pad_item = proto_tree_add_item(parent_tree, hf_ber_bitstring_padding, tvb, offset, 1, FALSE); + if (pad > 7) { + expert_add_info_format(actx->pinfo, pad_item, PI_UNDECODED, PI_WARN, + "Illegal padding (0 .. 7): %d", pad); + } } offset++; len--; @@ -4308,6 +4312,14 @@ int dissect_ber_constrained_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, p } } + if (pad > 0 && pad < 8 && len > 0) { + guint8 bits_in_pad = tvb_get_guint8(tvb, offset + len - 1) & (0xFF >> (8-pad)); + if (bits_in_pad) { + expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_WARN, + "Bits set in padded area: 0x%02x", bits_in_pad); + } + } + ber_check_length(8*len-pad, min_len, max_len, actx, item, TRUE); return end_offset; |