(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ncp2222.inc) |
| |
| 4731 | | | dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, guint32 it_verb, guint32 request_flags, guint32 ioffset, gboolean request_reply) |
| 4732 | | | { |
| 4733 | | | guint32 rcode, i, number_of_items, number_to_get; |
| 4734 | | | char *error_string, *verb_string; |
| 4735 | | | nds_val values; |
| 4736 | | | proto_tree *it_subtree, *it_subtree1; |
| 4737 | | | proto_item *it_subitem, *it_subitem1; |
| 4738 | | | proto_item *expert_item; |
| 4739 | | | |
| 4740 | | | values.vtype = 0; |
| 4741 | | | values.vvalue = 0; |
| 4742 | | | values.vlength = 0; |
| 4743 | | | values.voffset = 0; |
| 4744 | | | values.hfname = 0; |
| 4745 | | | values.vdesc = ""; |
| 4746 | | | values.vstring = NULL; |
| 4747 | | | values.mvtype = 0; |
| 4748 | | | values.vflags = 0; |
| 4749 | | | |
| 4750 | | | |
| 4751 | | | while (TRUE) { |
| 4752 | | | verb_string = (char *)match_strval(it_verb, iterator_subverbs); |
| 4753 | | | if(verb_string == NULL) |
| 4754 | | | { |
| 4755 | | | verb_string = "(No Iteration Verb Found)"; |
| 4756 | | | } |
| 4757 | | | it_subitem = proto_tree_add_uint_format(it_tree, hf_ncp_nds_iterverb, tvb, ioffset-4, 4, |
| 4758 | | | it_verb, "Iterator Verb: %d, (0x%04x), %s", |
| 4759 | | | it_verb, it_verb, verb_string); |
| 4760 | | | |
| 4761 | | | it_subtree = proto_item_add_subtree(it_subitem, ett_nds); |
| 4762 | | | |
| 4763 | | | if (request_reply) { |
| 4764 | | | switch (it_verb) { |
| 4765 | | | case IT_ATFIRST: |
| 4766 | | | case IT_ATEOF: |
| 4767 | | | case IT_ATLAST: |
| 4768 | | | case IT_ATBOF: |
| 4769 | | | case IT_CLEAR: |
| 4770 | | | case IT_COPY: |
| 4771 | | | break; |
| 4772 | | | case IT_COUNT: |
| 4773 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4774 | | | ioffset += 4; |
| 4775 | | | proto_tree_add_item(it_subtree, hf_max_entries, tvb, ioffset, 4, TRUE); |
| 4776 | | | ioffset += 4; |
| 4777 | | | proto_tree_add_item(it_subtree, hf_move_position, tvb, ioffset, 4, TRUE); |
| 4778 | | | ioffset += 4; |
| 4779 | | | break; |
| 4780 | | | case IT_CREATE: |
| 4781 | | | case IT_CURRENT: |
| 4782 | | | case IT_DESTROY: |
| 4783 | | | case IT_DONE: |
| 4784 | | | break; |
| 4785 | | | case IT_FIRST: |
| 4786 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4787 | | | ioffset += 4; |
| 4788 | | | break; |
| 4789 | | | case IT_GETPOSITION: |
| 4790 | | | case IT_ISPOSITIONABLE: |
| 4791 | | | break; |
| 4792 | | | case IT_LAST: |
| 4793 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4794 | | | ioffset += 4; |
| 4795 | | | break; |
| 4796 | | | case IT_NEXT: |
| 4797 | | | case IT_PREV: |
| 4798 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4799 | | | ioffset += 4; |
| 4800 | | | proto_tree_add_item(it_subtree, hf_num_to_get, tvb, ioffset, 4, TRUE); |
| 4801 | | | ioffset += 4; |
| 4802 | | | break; |
| 4803 | | | case IT_POSITION: |
| 4804 | | | proto_tree_add_item(it_subtree, hf_iter_position, tvb, ioffset, 4, TRUE); |
| 4805 | | | ioffset += 4; |
| 4806 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4807 | | | ioffset += 4; |
| 4808 | | | break; |
| 4809 | | | case IT_POSITION_IT: |
| 4810 | | | proto_tree_add_item(it_subtree, hf_iter_other, tvb, ioffset, 4, TRUE); |
| 4811 | | | ioffset += 4; |
| 4812 | | | break; |
| 4813 | | | case IT_SETINDEX: |
| 4814 | | | proto_tree_add_item(it_subtree, hf_nds_number_of_items, tvb, ioffset, 4, TRUE); |
| 4815 | | | number_of_items = tvb_get_letohl(tvb, ioffset); |
| 4816 | | | ioffset += 4; |
| 4817 | | | for (i=0; i < number_of_items; i++) { |
| 4818 | | | |
| 4819 | | | |
| 4820 | | | |
| 4821 | | | |
| 4822 | | | |
| 4823 | | | |
| 4824 | | | |
| 4825 | | | |
| 4826 | | | |
| 4827 | | | proto_tree_add_item(it_subtree, hf_iter_index, tvb, ioffset, 4, TRUE); |
| 4828 | | | ioffset = ioffset + 4; |
| 4829 | | | |
| 4830 | | | |
| 4831 | | | |
| 4832 | | | |
| 4833 | | | |
| 4834 | | | |
| 4835 | | | |
| 4836 | | | |
| 4837 | | | |
| 4838 | | | |
| 4839 | | | |
| 4840 | | | if (tvb_length_remaining(tvb, ioffset) < 4) { |
| 4841 | | | THROW(ReportedBoundsError);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
223 | #define THROW(x) \ |
224 | except_throw(XCEPT_GROUP_WIRESHARK, (x), NULL) |
| |
|
| 4842 | | | return; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. |
|
| 4843 | | | } |
| 4844 | | | } |
| 4845 | | | break; |
| 4846 | | | case IT_SETFILTER: |
| 4847 | | | |
| 4848 | | | values.voffset = ioffset; |
| 4849 | | | |
| 4850 | | | |
| 4851 | | | process_set_filter(it_subtree, tvb, pinfo, &values); |
| 4852 | | | |
| 4853 | | | ioffset = values.voffset; |
| 4854 | | | ioffset += align_4(tvb, ioffset); |
| 4855 | | | break; |
| 4856 | | | case IT_SKIP: |
| 4857 | | | proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE); |
| 4858 | | | ioffset += 4; |
| 4859 | | | proto_tree_add_item(it_subtree, hf_num_to_skip, tvb, ioffset, 4, TRUE); |
| 4860 | | | ioffset += 4; |
| 4861 | | | break; |
| 4862 | | | case IT_TYPEDOWN: |
| 4863 | | | proto_tree_add_item(it_subtree, hf_num_to_get, tvb, ioffset, 4, TRUE); |
| 4864 | | | number_to_get = tvb_get_letohl(tvb, ioffset); |
| 4865 | | | ioffset += 4; |
| 4866 | | | if (number_to_get == 0) { |
| 4867 | | | values.vvalue = tvb_get_letohl(tvb, ioffset); |
| 4868 | | | values.vstring = (char *)match_strval(values.vvalue, nds_tags); |
| 4869 | | | if(values.vstring == NULL) |
| 4870 | | | { |
| 4871 | | | values.vstring = "No Tags Set"; |
| 4872 | | | } |
| 4873 | | | proto_tree_add_string(it_tree, hf_nds_tag_string, tvb, ioffset, 4, values.vstring); |
| 4874 | | | ioffset = ioffset + 4; |
| 4875 | | | |
| 4876 | | | } |
| 4877 | | | values.vvalue = tvb_get_letohl(tvb, ioffset); |
| 4878 | | | ioffset = ioffset + 4; |
| 4879 | | | values.vstring = get_string(tvb, ioffset, values.vvalue); |
| 4880 | | | proto_tree_add_string(it_subtree, hf_mv_string, tvb, ioffset, |
| 4881 | | | values.vvalue, values.vstring); |
| 4882 | | | ioffset = ioffset + values.vvalue; |
| 4883 | | | ioffset += align_4(tvb, ioffset); |
| 4884 | | | break; |
| 4885 | | | default: |
| 4886 | | | if (tvb_length_remaining(tvb, ioffset) < 4) { |
| 4887 | | | THROW(ReportedBoundsError);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
223 | #define THROW(x) \ |
224 | except_throw(XCEPT_GROUP_WIRESHARK, (x), NULL) |
| |
|
| 4888 | | | } |
| 4889 | | | return; |
| 4890 | | | } |
| 4891 | | | } |
| 4892 | | | else |
| 4893 | | | { |
| 4894 | | | rcode = tvb_get_letohl(tvb, ioffset); |
| 4895 | | | error_string = (char *)match_strval(rcode, nds_reply_errors); |
| 4896 | | | if (error_string == NULL) { |
| 4897 | | | error_string = (char *)"Unknown Interation Verb Completion Code"; |
| 4898 | | | } |
| 4899 | | | expert_item = proto_tree_add_uint_format(it_subtree, hf_iter_verb_completion_code, tvb, ioffset, |
| 4900 | | | 4, rcode, "Completion Code: 0x%08x, %s", |
| 4901 | | | rcode, error_string ); |
| 4902 | | | |
| 4903 | | | if (rcode != 0 && ncp_echo_err) { |
| 4904 | | | expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Iteration Verb Error: 0x%08x %s", rcode, error_string); |
| 4905 | | | } |
| 4906 | | | ioffset += 4; |
| 4907 | | | |
| 4908 | | | switch (it_verb) { |
| 4909 | | | case IT_ATFIRST: |
| 4910 | | | case IT_ATEOF: |
| 4911 | | | case IT_ATLAST: |
| 4912 | | | case IT_ATBOF: |
| 4913 | | | proto_tree_add_item(it_subtree, hf_iter_ans, tvb, ioffset, 4, TRUE); |
| 4914 | | | ioffset += 4; |
| 4915 | | | break; |
| 4916 | | | case IT_CLEAR: |
| 4917 | | | break; |
| 4918 | | | case IT_COPY: |
| 4919 | | | proto_tree_add_item(it_subtree, hf_iter_copy, tvb, ioffset, 4, TRUE); |
| 4920 | | | ioffset += 4; |
| 4921 | | | break; |
| 4922 | | | case IT_COUNT: |
| 4923 | | | proto_tree_add_item(it_subtree, hf_this_count, tvb, ioffset, 4, TRUE); |
| 4924 | | | ioffset += 4; |
| 4925 | | | break; |
| 4926 | | | case IT_CREATE: |
| 4927 | | | proto_tree_add_item(it_subtree, hf_nds_iterator, tvb, ioffset, 4, TRUE); |
| 4928 | | | ioffset += 4; |
| 4929 | | | break; |
| 4930 | | | case IT_CURRENT: |
| 4931 | | | case IT_NEXT: |
| 4932 | | | case IT_PREV: |
| 4933 | | | case IT_FIRST: |
| 4934 | | | case IT_LAST: |
| 4935 | | | values.vvalue = tvb_get_letohl(tvb, ioffset); |
| 4936 | | | values.vstring = (char *)match_strval(values.vvalue, nds_info_type); |
| 4937 | | | if(values.vstring == NULL) |
| 4938 | | | { |
| 4939 | | | values.vstring = "No Info Type Set"; |
| 4940 | | | } |
| 4941 | | | proto_tree_add_string(it_subtree, hf_nds_info_type, tvb, ioffset, 4, values.vstring); |
| 4942 | | | ioffset = ioffset + 4; |
| 4943 | | | proto_tree_add_item(it_subtree, hf_data_size, tvb, ioffset, 4, TRUE); |
| 4944 | | | ioffset += 4; |
| 4945 | | | number_of_items = tvb_get_letohl(tvb, ioffset); |
| 4946 | | | proto_tree_add_item(it_subtree, hf_this_count, tvb, ioffset, 4, TRUE); |
| 4947 | | | ioffset += 4; |
| 4948 | | | for (i = 0; i < number_of_items; i++) |
| 4949 | | | { |
| 4950 | | | it_subitem1 = proto_tree_add_text(it_subtree, tvb, ioffset, -1, "Item #: %u", i+1); |
| 4951 | | | it_subtree1 = proto_item_add_subtree(it_subitem1, ett_nds); |
| 4952 | | | |
| 4953 | | | ioffset += align_4(tvb, ioffset); |
| 4954 | | | |
| 4955 | | | |
| 4956 | | | values.voffset = ioffset; |
| 4957 | | | values.vflags = request_flags; |
| 4958 | | | process_entry_info(it_subtree1, tvb, &values); |
| 4959 | | | ioffset = values.voffset; |
| 4960 | | | |
| 4961 | | | |
| 4962 | | | ioffset += align_4(tvb, ioffset); |
| 4963 | | | |
| 4964 | | | |
| 4965 | | | |
| 4966 | | | ioffset += 8; |
| 4967 | | | |
| 4968 | | | if (tvb_length_remaining(tvb, ioffset) < 4) { |
| 4969 | | | break; |
| 4970 | | | } |
| 4971 | | | } |
| 4972 | | | break; |
| 4973 | | | case IT_DESTROY: |
| 4974 | | | case IT_DONE: |
| 4975 | | | break; |
| 4976 | | | case IT_GETPOSITION: |
| 4977 | | | proto_tree_add_item(it_subtree, hf_iter_position, tvb, ioffset, 4, TRUE); |
| 4978 | | | ioffset += 4; |
| 4979 | | | break; |
| 4980 | | | case IT_ISPOSITIONABLE: |
| 4981 | | | proto_tree_add_item(it_subtree, hf_positionable, tvb, ioffset, 4, TRUE); |
| 4982 | | | ioffset += 4; |
| 4983 | | | break; |
| 4984 | | | case IT_POSITION: |
| 4985 | | | case IT_POSITION_IT: |
| 4986 | | | case IT_SETFILTER: |
| 4987 | | | case IT_TYPEDOWN: |
| 4988 | | | break; |
| 4989 | | | case IT_SETINDEX: |
| 4990 | | | proto_tree_add_item(it_subtree, hf_iter_index, tvb, ioffset, 4, TRUE); |
| 4991 | | | ioffset += 4; |
| 4992 | | | break; |
| 4993 | | | case IT_SKIP: |
| 4994 | | | proto_tree_add_item(it_subtree, hf_num_skipped, tvb, ioffset, 4, TRUE); |
| 4995 | | | ioffset += 4; |
| 4996 | | | break; |
| 4997 | | | default: |
| 4998 | | | if (tvb_length_remaining(tvb, ioffset) < 4) { |
| 4999 | | | THROW(ReportedBoundsError);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
223 | #define THROW(x) \ |
224 | except_throw(XCEPT_GROUP_WIRESHARK, (x), NULL) |
| |
|
| 5000 | | | } |
| 5001 | | | return; |
| 5002 | | | } |
| 5003 | | | } |
| 5004 | | | it_verb = tvb_get_letohl(tvb, ioffset); |
| 5005 | | | ioffset += 4; |
| 5006 | | | if (it_verb == IT_DONE || tvb_length_remaining(tvb, ioffset) < 4) { |
| 5007 | | | verb_string = (char *)match_strval(it_verb, iterator_subverbs); |
| 5008 | | | if(verb_string == NULL) |
| 5009 | | | { |
| 5010 | | | verb_string = "Internal error processing NDS iteration verbs"; |
| 5011 | | | } |
| 5012 | | | it_subitem = proto_tree_add_uint_format(it_tree, hf_ncp_nds_iterverb, tvb, ioffset-4, 4, |
| 5013 | | | it_verb, "Iterator Verb: %d, (0x%04x), %s", |
| 5014 | | | it_verb, it_verb, verb_string); |
| 5015 | | | break; |
| 5016 | | | } |
| 5017 | | | } |
| 5018 | | | return; |
| 5019 | | | } |
| |