Text   |  XML   |  ReML   |   Visible Warnings:

Cast Alters Value  at proto.c:2701

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

dissect_pflog

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-pflog.c)expand/collapse
Show more  
 118  dissect_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 119  {
 120  #define MAX_RULE_STR 128
 121    struct pfloghdr pflogh;
 122    static char rulestr[MAX_RULE_STR];
 123    tvbuff_t *next_tvb;
 124    proto_tree *pflog_tree;
 125    proto_item *ti;
 126    int hdrlen;
 127   
 128[+]   if (check_col(pinfo->cinfo, COL_PROTOCOL))
 129      col_set_str(pinfo->cinfo, COL_PROTOCOL, "PFLOG");
 130   
 131    /* Copy out the pflog header to insure alignment */
 132    tvb_memcpy(tvb, (guint8 *)&pflogh, 0, sizeof(pflogh));
 133   
 134    /* Byteswap the header now */
 135    pflogh.rulenr = g_ntohl(pflogh.rulenr);
 136    pflogh.subrulenr = g_ntohl(pflogh.subrulenr);
 137   
 138    hdrlen = BPF_WORDALIGN(pflogh.length);
 139   
 140    if (pflogh.subrulenr == (guint32) -1)
 141      g_snprintf(rulestr, sizeof(rulestr), "%u",
 142               pflogh.rulenr);
 143    else 
 144      g_snprintf(rulestr, sizeof(rulestr), "%u.%s.%u",
 145               pflogh.rulenr, pflogh.ruleset, pflogh.subrulenr);
 146   
 147    if (hdrlen < MIN_PFLOG_HDRLEN) {
 148      if (tree) {
 149        ti = proto_tree_add_protocol_format(tree, proto_pflog, tvb, 0,
 150                 hdrlen, "PF Log invalid header length (%u)", hdrlen);
 151      }
 152      if (check_col(pinfo->cinfo, COL_INFO)) {
 153        col_prepend_fstr(pinfo->cinfo, COL_INFO, "Invalid header length %u",
 154            hdrlen);
 155      }
 156      return;
 157    }
 158   
 159    if (tree) {
 160      ti = proto_tree_add_protocol_format(tree, proto_pflog, tvb, 0,
 161               hdrlen,
 162               "PF Log %s %s on %s by rule %s",
 163               val_to_str(pflogh.af, af_vals, "unknown (%u)"),
 164               val_to_str(pflogh.action, action_vals, "unknown (%u)"),
 165               pflogh.ifname,
 166[+]              rulestr);
 167      pflog_tree = proto_item_add_subtree(ti, ett_pflog);
 168   
 169      proto_tree_add_uint(pflog_tree, hf_pflog_length, tvb,
 170               offsetof(struct pfloghdr, length), sizeof(pflogh.length),
 171               pflogh.length);
 172      proto_tree_add_uint(pflog_tree, hf_pflog_af, tvb,
 173               offsetof(struct pfloghdr, af), sizeof(pflogh.af),
 174               pflogh.af);
 175      proto_tree_add_uint(pflog_tree, hf_pflog_action, tvb,
 176               offsetof(struct pfloghdr, action), sizeof(pflogh.action),
 177               pflogh.action);
 178      proto_tree_add_uint(pflog_tree, hf_pflog_reason, tvb,
 179               offsetof(struct pfloghdr, reason), sizeof(pflogh.reason),
 180               pflogh.reason);
 181      proto_tree_add_string(pflog_tree, hf_pflog_ifname, tvb,
 182               offsetof(struct pfloghdr, ifname), sizeof(pflogh.ifname),
 183               pflogh.ifname);
 184      proto_tree_add_string(pflog_tree, hf_pflog_ruleset, tvb,
 185               offsetof(struct pfloghdr, ruleset), sizeof(pflogh.ruleset),
 186               pflogh.ruleset);
 187      proto_tree_add_int(pflog_tree, hf_pflog_rulenr, tvb,
 188               offsetof(struct pfloghdr, rulenr), sizeof(pflogh.rulenr),
 189               pflogh.rulenr);
 190      proto_tree_add_int(pflog_tree, hf_pflog_subrulenr, tvb,
 191               offsetof(struct pfloghdr, subrulenr), sizeof(pflogh.subrulenr),
 192[+]              pflogh.subrulenr);
expand/collapse

proto_tree_add_int

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 2626  proto_item *
 2627  proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
 2628                  gint32 value)
 2629  {
 2630          proto_item              *pi = NULL;
 2631          field_info              *new_fi;
 2632          header_field_info       *hfinfo;
 2633   
 2634          if (!tree)
 2635                  return (NULL);
 2636   
 2637          TRY_TO_FAKE_THIS_ITEM(tree, hfindex);
 2638   
 2639          PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo);
 2640          switch(hfinfo->type) {
 2641                  case FT_INT8:
 2642                  case FT_INT16:
 2643                  case FT_INT24:
 2644                  case FT_INT32:
 2645                          pi = proto_tree_add_pi(tree, hfindex, tvb, start, &length,
 2646                                          &new_fi);
 2647[+]                         proto_tree_set_int(new_fi, value);
expand/collapse

proto_tree_set_int

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 2695  proto_tree_set_int(field_info *fi, gint32 value)
 2696  {
 2697          header_field_info       *hfinfo;
 2698          guint32                 integer;
 2699   
 2700          hfinfo = fi->hfinfo;
 2701          integer = (guint32) value;
Show more  
Show more  
Show more  




Change Warning 2884.30987 : Cast Alters Value

Priority:
State:
Finding:
Owner:
Note: