Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-pgsql.c:252

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

dissect_pgsql_msg

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-pgsql.c)expand/collapse
Show more  
 215  dissect_pgsql_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 216  {
 217      proto_item *ti, *hidden_item;
 218      proto_tree *ptree;
 219   
 220      gint n;
 221      guchar type;
 222      const char *typestr;
 223      guint length;
 224      gboolean info = check_col(pinfo->cinfo, COL_INFO);
 225      gboolean fe = (pinfo->match_port == pinfo->destport);
 226   
 227      n = 0;
 228      type = tvb_get_guint8(tvb, 0);
 229      if (type != '\0')
 230          n += 1;
 231      length = tvb_get_ntohl(tvb, n);
 232   
 233      /* This is like specifying VALS(messages) for hf_type, which we can't do 
 234         directly because of messages without type bytes, and because the type
 235         interpretation depends on fe. */
 236      if (fe) {
 237          /* There are a few frontend messages that have no leading type byte.
 238             We identify them by the fact that the first byte of their length
 239             must be zero, and that the next four bytes are a unique tag. */
 240          if (type == '\0') {
 241              guint tag = tvb_get_ntohl(tvb, 4);
 242   
 243              if (length == 16 && tag == 80877102)
 244                  typestr = "Cancel request";
 245              else if (length == 8 && tag == 80877103)
 246                  typestr = "SSL request";
 247              else if (tag == 196608)
 248                  typestr = "Startup message";
 249              else 
 250                  typestr = "Unknown";
 251          } else 
 252              typestr = val_to_str(type, fe_messages, "Unknown");
 253      }
 254      else {
 255          typestr = val_to_str(type, be_messages, "Unknown");
 256      }
 257   
 258      if (info) {
 259          /* This is a terrible hack. It makes the "Info" column reflect
 260             the contents of every message in a TCP packet. Could it be 
 261             done any better? */
 262          col_append_fstr(pinfo->cinfo, COL_INFO, "%s%c",
 263                          ( first_message ? "" : "/" ), type);
 264          first_message = FALSE;
 265      }
 266   
 267      if (tree) {
 268          ti = proto_tree_add_item(tree, proto_pgsql, tvb, 0, -1, FALSE);
 269          ptree = proto_item_add_subtree(ti, ett_pgsql);
 270   
 271          n = 1;
 272          if (type == '\0')
 273              n = 0;
 274          proto_tree_add_text(ptree, tvb, 0, n, "Type: %s", typestr);
 275          hidden_item = proto_tree_add_item(ptree, hf_type, tvb, 0, n, FALSE);
 276          PROTO_ITEM_SET_HIDDEN(hidden_item);
 277          proto_tree_add_item(ptree, hf_length, tvb, n, 4, FALSE);
 278          hidden_item = proto_tree_add_boolean(ptree, hf_frontend, tvb, 0, 0, fe);
 279          PROTO_ITEM_SET_HIDDEN(hidden_item);
 280          n += 4;
 281   
 282          if (fe)
 283              dissect_pgsql_fe_msg(type, length, tvb, n, ptree);
 284          else 
 285              dissect_pgsql_be_msg(type, length, tvb, n, ptree);
 286      }
 287  }
Show more  




Change Warning 5477.35737 : Ignored Return Value

Because they are very similar, this warning shares annotations with warning 5477.35738.

Priority:
State:
Finding:
Owner:
Note: