Text   |  XML   |  ReML   |   Visible Warnings:

Format String  at packet-wmx.c:797

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

add_protocol_subtree

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/packet-wmx.c)expand/collapse
Show more  
 728  proto_tree *add_protocol_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, const char *format, ...)
 729  {
 730          /* Declare local variables */
 731          proto_tree *tlv_tree;
 732          proto_item *tlv_item;
 733          guint start_of_tlv;
 734          gint tlv_value_length, tlv_val_offset;
 735          guint8 size_of_tlv_length_field;
 736          guint8 tlv_type;
 737          guint32 tlv_value;
 738          va_list ap; /* points to each unnamed arg in turn */
 739          gchar *message = NULL;
 740          gchar *hex_fmt;
 741   
 742          /* Retrieve the necessary TLV information */
 743          tlv_val_offset = get_tlv_value_offset(this);
 744          start_of_tlv = start - tlv_val_offset;
 745          tlv_value_length = get_tlv_length(this);
 746          size_of_tlv_length_field = get_tlv_size_of_length(this);
 747          tlv_type = get_tlv_type(this);
 748   
 749          /* display the TLV name and display the value in hex. Highlight type, length, and value. */
 750          va_start(ap, format);
 751          message = se_strdup_vprintf(format, ap);
 752          va_end(ap);
 753          tlv_item = proto_tree_add_protocol_format(tree, hfindex, tvb, start, length, "%s", message);
 754          /* Correct the highlighting. */
 755          tlv_item->finfo->start -= tlv_val_offset;
 756          tlv_item->finfo->length += tlv_val_offset;
 757          /* add TLV subtree to contain the type, length, and value */
 758          tlv_tree = proto_item_add_subtree(tlv_item, *ett_tlv[tlv_type]);
 759          /* display the TLV type */
 760          proto_tree_add_text(tlv_tree, tvb, start_of_tlv, 1, "TLV type: %u", tlv_type);
 761          /* check if this is an extended TLV */
 762          if (size_of_tlv_length_field > 0) /* It is */
 763          {
 764                  /* display the length of the length field TLV */
 765                  proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "Size of TLV length field: %u", size_of_tlv_length_field);
 766                  /* display the TLV length */
 767                  proto_tree_add_text(tlv_tree, tvb, start_of_tlv+2, size_of_tlv_length_field, "TLV length: %u", tlv_value_length);
 768          } else { /* It is not */
 769                  /* display the TLV length */
 770                  proto_tree_add_text(tlv_tree, tvb, start_of_tlv+1, 1, "TLV length: %u", tlv_value_length);
 771          }
 772          /* display the TLV value and make it a subtree */
 773          switch (tlv_value_length)
 774          {
 775                  case 1:
 776                          tlv_value = tvb_get_guint8(tvb, start);
 777                          hex_fmt = tlv_val_1byte;
 778                          break;
 779                  case 2:
 780                          tlv_value = tvb_get_ntohs(tvb, start);
 781                          hex_fmt = tlv_val_2byte;
 782                          break;
 783                  case 3:
 784                          tlv_value = tvb_get_ntoh24(tvb, start);
 785                          hex_fmt = tlv_val_3byte;
 786                          break;
 787                  case 4:
 788                          tlv_value = tvb_get_ntohl(tvb, start);
 789                          hex_fmt = tlv_val_4byte;
 790                          break;
 791                  default:
 792                          tlv_value = tvb_get_ntohl(tvb, start);
 793                          hex_fmt = tlv_val_5byte;
 794                          break;
 795          }
 796          /* Show "TLV value: " */
 797          tlv_item = proto_tree_add_text(tlv_tree, tvb, start, length, hex_fmt, message, tlv_value);
 798          tlv_tree = proto_item_add_subtree(tlv_item, idx);
 799   
 800          /* Return a pointer to the value level */
 801          return tlv_tree;
 802  }
Show more  




Change Warning 5566.35861 : Format String

Priority:
State:
Finding:
Owner:
Note: