Text   |  XML   |  ReML   |   Visible Warnings:

Format String  at proto.c:5862

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

proto_item_add_bitmask_tree

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 5785  proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, int offset, int len, gint ett,
 5786          const int **fields, gboolean little_endian, int flags, gboolean first)
 5787  {
 5788          guint32 value = 0, tmpval;
 5789          proto_tree *tree = NULL;
 5790          header_field_info *hf;
 5791          const char *fmt;
 5792   
 5793          switch (len) {
 5794          case 1:
 5795                  value = tvb_get_guint8(tvb, offset);
 5796                  break;
 5797          case 2:
 5798                  value = little_endian ? tvb_get_letohs(tvb, offset) :
 5799                          tvb_get_ntohs(tvb, offset);
 5800                  break;
 5801          case 3:
 5802                  value = little_endian ? tvb_get_letoh24(tvb, offset) :
 5803                          tvb_get_ntoh24(tvb, offset);
 5804                  break;
 5805          case 4:
 5806                  value = little_endian ? tvb_get_letohl(tvb, offset) :
 5807                          tvb_get_ntohl(tvb, offset);
 5808                  break;
 5809          default:
 5810                  g_assert_not_reached();
 5811          }
 5812   
 5813          tree = proto_item_add_subtree(item, ett);
 5814          while (*fields) {
 5815                  proto_tree_add_item(tree, **fields, tvb, offset, len, little_endian);
 5816                  if (flags & BMT_NO_APPEND) {
 5817                          fields++;
 5818                          continue;
 5819                  }
 5820                  hf = proto_registrar_get_nth(**fields);
 5821                  DISSECTOR_ASSERT(hf->bitmask != 0);
 5822                  tmpval = (value & hf->bitmask) >> hf->bitshift;
 5823   
 5824                  switch (hf->type) {
 5825                  case FT_INT8:
 5826                  case FT_UINT8:
 5827                  case FT_INT16:
 5828                  case FT_UINT16:
 5829                  case FT_INT24:
 5830                  case FT_UINT24:
 5831                  case FT_INT32:
 5832                  case FT_UINT32:
 5833                          DISSECTOR_ASSERT(len == ftype_length(hf->type));
 5834   
 5835                          if (hf->display == BASE_CUSTOM) {
 5836                                  gchar lbl[ITEM_LABEL_LENGTH];
 5837                                  custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hf->strings;
 5838   
 5839                                  DISSECTOR_ASSERT(fmtfunc);
 5840                                  fmtfunc(lbl, tmpval);
 5841                                  proto_item_append_text(item, "%s%s: %s", first ? "" : ", ",
 5842                                                  hf->name, lbl);
 5843                                  first = FALSE;
 5844                          }
 5845                          else if (hf->strings) {
 5846                                  if (hf->display & BASE_RANGE_STRING) {
 5847                                          proto_item_append_text(item, "%s%s: %s", first ? "" : ", ",
 5848                                                                 hf->name, rval_to_str(tmpval, hf->strings, "Unknown"));
 5849                                  } else {
 5850                                          proto_item_append_text(item, "%s%s: %s", first ? "" : ", ",
 5851                                                                 hf->name, val_to_str(tmpval, cVALS(hf->strings), "Unknown"));
 5852                                  }
 5853                                  first = FALSE;
 5854                          }
 5855                          else if (!(flags & BMT_NO_INT)) {
 5856                                  if (!first) {
 5857                                          proto_item_append_text(item, ", ");
 5858                                  }
 5859   
 5860                                  fmt = IS_FT_INT(hf->type) ? hfinfo_int_format(hf) : hfinfo_uint_format(hf);
 5861                                  if (IS_BASE_DUAL(hf->display)) {
 5862                                          proto_item_append_text(item, fmt, hf->name, tmpval, tmpval);
 5863                                  } else {
 5864                                          proto_item_append_text(item, fmt, hf->name, tmpval);
 5865                                  }
 5866                                  first = FALSE;
 5867                          }
 5868   
 5869                          break;
 5870                  case FT_BOOLEAN:
 5871                          DISSECTOR_ASSERT(len * 8 == hf->display);
 5872   
 5873                          if (hf->strings && !(flags & BMT_NO_TFS)) {
 5874                                  /* If we have true/false strings, emit full - otherwise messages
 5875                                     might look weird */
 5876                                  const struct true_false_string *tfs =
 5877                                          (const struct true_false_string *)hf->strings;
 5878   
 5879                                  if (tmpval) {
 5880                                          proto_item_append_text(item, "%s%s: %s", first ? "" : ", ",
 5881                                                          hf->name, tfs->true_string);
 5882                                          first = FALSE;
 5883                                  } else if (!(flags & BMT_NO_FALSE)) {
 5884                                          proto_item_append_text(item, "%s%s: %s", first ? "" : ", ",
 5885                                                          hf->name, tfs->false_string);
 5886                                          first = FALSE;
 5887                                  }
 5888                          } else if (hf->bitmask & value) {
 5889                                  /* If the flag is set, show the name */
 5890                                  proto_item_append_text(item, "%s%s", first ? "" : ", ", hf->name);
 5891                                  first = FALSE;
 5892                          }
 5893                          break;
 5894                  default:
 5895                          g_assert_not_reached();
 5896                  }
 5897   
 5898                  fields++;
 5899          }
 5900   
 5901          return first;
 5902  }
Show more  




Change Warning 5581.35887 : Format String

Priority:
State:
Finding:
Owner:
Note: