(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-artnet.c) |
| |
| 753 | | | dissect_artnet_output(tvbuff_t *tvb, guint offset, proto_tree *tree) |
| 754 | | | { |
| 755 | | | proto_tree *hi,*si; |
| 756 | | | proto_item *item; |
| 757 | | | guint16 length,r,c,row_count; |
| 758 | | | guint8 v; |
| 759 | | | static char string[255]; |
| 760 | | | char* ptr; |
| 761 | | | const char* chan_format[] = { |
| 762 | | | "%2u ", |
| 763 | | | "%02x ", |
| 764 | | | "%3u " |
| 765 | | | }; |
| 766 | | | const char* string_format[] = { |
| 767 | | | "%03x: %s", |
| 768 | | | "%3u: %s" |
| 769 | | | }; |
| 770 | | | |
| 771 | | | proto_tree_add_item(tree, hf_artnet_output_sequence, tvb, |
| 772 | | | offset, 1, FALSE); |
| 773 | | | offset += 1; |
| 774 | | | |
| 775 | | | proto_tree_add_item(tree, hf_artnet_output_physical, tvb, |
| 776 | | | offset, 1, FALSE); |
| 777 | | | offset += 1; |
| 778 | | | |
| 779 | | | proto_tree_add_item(tree, hf_artnet_output_universe, tvb, |
| 780 | | | offset, 2, TRUE); |
| 781 | | | offset += 2; |
| 782 | | | |
| 783 | | | length = tvb_get_ntohs(tvb, offset); |
| 784 | | | proto_tree_add_uint(tree, hf_artnet_output_length, tvb, |
| 785 | | | offset, 2, length); |
| 786 | | | offset += 2; |
| 787 | | | |
| 788 | | | hi = proto_tree_add_item(tree, |
| 789 | | | hf_artnet_output_data, |
| 790 | | | tvb, |
| 791 | | | offset, |
| 792 | | | length, |
| 793 | | | FALSE); |
| 794 | | | |
| 795 | | | si = proto_item_add_subtree(hi, ett_artnet); |
| 796 | | | |
| 797 | | | row_count = (length/global_disp_col_count) + ((length%global_disp_col_count) == 0 ? 0 : 1); |
| 798 | | | ptr = string; |
| 799 | | | |
| 800 | | | |
| 801 | | | |
| 802 | | | |
| 803 | | | |
| 804 | | | |
| 805 | | | |
| 806 | | | for (r=0; r < row_count;r++) { |
| 807 | | | for (c=0;(c < global_disp_col_count) && (((r*global_disp_col_count)+c) < length);c++) { |
| 808 | | | if ((c % (global_disp_col_count/2)) == 0) { |
| 809 | | | ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), " "); |
| 810 | | | } |
| 811 | | | |
| 812 | | | v = tvb_get_guint8(tvb, (offset+(r*global_disp_col_count)+c)); |
| 813 | | | if (global_disp_chan_val_type == 0) { |
| 814 | | | v = (v * 100) / 255; |
| 815 | | | if (v == 100) { |
| 816 | | | ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), "FL "); |
| 817 | | | } else { |
| 818 | | | ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), chan_format[global_disp_chan_val_type], v); |
| 819 | | | } |
| 820 | | | } else { |
| 821 | | | ptr += g_snprintf(ptr, (gulong)(sizeof string - strlen(string)), chan_format[global_disp_chan_val_type], v); |
| 822 | | | } |
| 823 | | | } |
| 824 | | | |
| 825 | | | proto_tree_add_none_format(si,hf_artnet_output_dmx_data, tvb, |
| 826 | | | offset+(r*global_disp_col_count), c, |
| 827 | | | string_format[global_disp_chan_nr_type], (r*global_disp_col_count)+1, string); |
Format String
proto_tree_add_none_format() is being called with a format string that is not constant. The format string (sixth argument) may not match the other arguments to proto_tree_add_none_format(); this could lead to security or stability problems. proto_tree_add_none_format() is usually called with strings that look like format strings in this project. |
|
| 828 | | | ptr = string; |
| 829 | | | } |
| 830 | | | |
| 831 | | | |
| 832 | | | item = proto_tree_add_item(si, hf_artnet_output_data_filter, tvb, |
| 833 | | | offset, length, FALSE ); |
| 834 | | | PROTO_ITEM_SET_HIDDEN(item);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 835 | | | offset += length; |
| 836 | | | |
| 837 | | | return offset; |
| 838 | | | } |
| |