(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ber.c) |
| |
| 3878 | | | int dissect_ber_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const asn_namedbit *named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb) |
| 3879 | | | { |
| 3880 | | | gint8 class; |
| 3881 | | | gboolean pc, ind; |
| 3882 | | | gint32 tag; |
| 3883 | | | guint32 len; |
| 3884 | | | guint8 pad=0, b0, b1, val; |
| 3885 | | | int end_offset; |
| 3886 | | | int hoffset; |
| 3887 | | | proto_item *item = NULL; |
| 3888 | | | proto_item *cause; |
| 3889 | | | proto_tree *tree = NULL; |
| 3890 | | | const asn_namedbit *nb; |
| 3891 | | | const char *sep; |
| 3892 | | | gboolean term; |
| 3893 | | | |
| 3894 | | | if(!implicit_tag){ |
Event 1:
Taking false branch. implicit_tag evaluates to true.
hide
|
|
| 3895 | | | hoffset = offset; |
| 3896 | | | |
| 3897 | | | offset = dissect_ber_identifier(actx->pinfo, parent_tree, tvb, offset, &class, &pc, &tag); |
| 3898 | | | offset = dissect_ber_length(actx->pinfo, parent_tree, tvb, offset, &len, &ind); |
| 3899 | | | end_offset = offset + len; |
| 3900 | | | |
| 3901 | | | |
| 3902 | | | |
| 3903 | | | |
| 3904 | | | |
| 3905 | | | |
| 3906 | | | |
| 3907 | | | |
| 3908 | | | |
| 3909 | | | if(!implicit_tag && (class!=BER_CLASS_APP)) { |
| 3910 | | | if( (class!=BER_CLASS_UNI) |
| 3911 | | | ||(tag!=BER_UNI_TAG_BITSTRING) ){ |
| 3912 | | | tvb_ensure_bytes_exist(tvb, hoffset, 2); |
| 3913 | | | cause = proto_tree_add_text(parent_tree, tvb, offset, len, "BER Error: BitString expected but class:%s(%d) %s tag:%d was unexpected", val_to_str(class,ber_class_codes,"Unknown"), class, pc ? ber_pc_codes_short.true_string : ber_pc_codes_short.false_string, tag); |
| 3914 | | | proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); |
| 3915 | | | expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: BitString expected"); |
| 3916 | | | if (decode_unexpected) { |
| 3917 | | | proto_tree *unknown_tree = proto_item_add_subtree(cause, ett_ber_unknown); |
| 3918 | | | dissect_unknown_ber(actx->pinfo, tvb, hoffset, unknown_tree); |
| 3919 | | | } |
| 3920 | | | return end_offset; |
| 3921 | | | } |
| 3922 | | | } |
| 3923 | | | } else { |
| 3924 | | | pc=0; |
| 3925 | | | len=tvb_length_remaining(tvb,offset); |
| 3926 | | | end_offset=offset+len; |
| 3927 | | | } |
| 3928 | | | |
| 3929 | | | actx->created_item = NULL; |
| 3930 | | | |
| 3931 | | | if(pc) { |
Event 2:
Taking false branch. pc evaluates to false.
hide
|
|
| 3932 | | | |
| 3933 | | | |
| 3934 | | | } else { |
| 3935 | | | |
| 3936 | | | pad = tvb_get_guint8(tvb, offset); |
| 3937 | | | if(pad == 0 && len == 1) { |
| 3938 | | | |
| 3939 | | | proto_tree_add_item(parent_tree, hf_ber_bitstring_empty, tvb, offset, 1, FALSE); |
| 3940 | | | } else { |
| 3941 | | | |
| 3942 | | | proto_tree_add_item(parent_tree, hf_ber_bitstring_padding, tvb, offset, 1, FALSE); |
| 3943 | | | } |
| 3944 | | | offset++; |
| 3945 | | | len--; |
| 3946 | | | if( hf_id >= 0) { |
Event 4:
Skipping " if". hf_id >= 0 evaluates to false.
hide
|
|
| 3947 | | | item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE); |
| 3948 | | | actx->created_item= item; |
| 3949 | | | if(ett_id != -1) { |
| 3950 | | | tree = proto_item_add_subtree(item, ett_id); |
| 3951 | | | } |
| 3952 | | | } |
| 3953 | | | if(out_tvb) { |
Event 5:
Taking true branch. out_tvb evaluates to true.
hide
|
|
| 3954 | [+] | | if(len<=(guint32)tvb_length_remaining(tvb, offset)){ |
 |
| |