Text   |  XML   |  ReML   |   Visible Warnings:

Cast Alters Value  at tvbuff.c:1802

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

dissect_dcc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-dcc.c)expand/collapse
Show more  
 212  dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 213  {
 214          proto_tree      *dcc_tree, *dcc_optree, *dcc_opnumtree, *ti;
 215          proto_tree *dcc_tracetree;
 216          proto_item *hidden_item;
 217          int offset = 0;
 218          int client_is_le = 0;
 219          int op = 0;
 220          int i, is_response;
 221   
 222          if (pinfo->srcport != DCC_PORT && pinfo->destport != DCC_PORT) {
 223                  /* Not the right port - not a DCC packet. */
 224                  return FALSE;
 225          }
 226   
 227          /* get at least a full packet structure */
 228          if ( tvb_length(tvb) < sizeof(DCC_HDR) ) {
 229                  /* Doesn't have enough bytes to contain packet header. */
 230                  return FALSE;
 231          }
 232   
 233[+]         if (check_col(pinfo->cinfo, COL_PROTOCOL))
 234                  col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCC");
 235   
 236          offset = 0;
 237          is_response = pinfo->srcport == DCC_PORT;
 238   
 239[+]         if (check_col(pinfo->cinfo, COL_INFO)) {
 240                  col_add_fstr(pinfo->cinfo, COL_INFO,
 241                          "%s: %s",
 242                          is_response ? "Response" : "Request",
 243                          val_to_str(tvb_get_guint8(tvb, offset+3),
 244                                   dcc_op_vals, "Unknown Op: %u")
 245                  );
 246          }
 247   
 248          if (tree) {
 249                  ti = proto_tree_add_item(tree, proto_dcc, tvb, offset, -1,
 250[+]                         FALSE);
 251                  dcc_tree = proto_item_add_subtree(ti, ett_dcc);
 252   
 253                  proto_tree_add_item(dcc_tree, hf_dcc_len, tvb,
 254                          offset, 2, FALSE);
 255   
 256                  if ( tvb_length(tvb) < tvb_get_ntohs(tvb, offset)) {
 257                          /* Doesn't have number of bytes that header claims. */
 258                          proto_tree_add_text(dcc_tree, tvb, offset, 2, "Error - packet is shorter than header claims!");
 259                  }
 260                  offset += 2;
 261   
 262                  proto_tree_add_item(dcc_tree, hf_dcc_pkt_vers, tvb,
 263                          offset, 1, FALSE);
 264                  offset += 1;
 265   
 266[+]                 op = tvb_get_guint8(tvb, offset);
 267                  proto_tree_add_item(dcc_tree, hf_dcc_op, tvb,
 268                          offset, 1, FALSE);
 269                  offset += 1;
 270   
 271                  proto_tree_add_item(dcc_tree, hf_dcc_clientid, tvb,
 272                          offset, 4, FALSE);
 273                  offset += 4;
 274   
 275                  ti = proto_tree_add_text(dcc_tree, tvb, offset, -1, "Operation Numbers (Opaque to Server)");
 276                  dcc_opnumtree = proto_item_add_subtree(ti, ett_dcc_opnums);
 277   
 278                  /* Note - these are indeterminate - they are sortof considered opaque to the client */
 279                  /* Make some attempt to figure out if this data is little endian, not guaranteed to be
 280                  correct if connection went through a firewall or similar. */
 281   
 282                  /* Very hokey check - if all three of pid/report/retrans look like little-endian
 283                          numbers, host is probably little endian. Probably innacurate on super-heavily-used
 284                          DCC clients though. This should be good enough for now. */
 285                  client_is_le = ( (tvb_get_guint8(tvb, offset+4) | tvb_get_guint8(tvb, offset+4)) &&
 286                                                   (tvb_get_guint8(tvb, offset+8) | tvb_get_guint8(tvb, offset+9)) &&
 287                                                   (tvb_get_guint8(tvb, offset+12) | tvb_get_guint8(tvb, offset+13)) );
 288   
 289                  proto_tree_add_item(dcc_opnumtree, hf_dcc_opnums_host, tvb,
 290                          offset, 4, client_is_le);
 291                  offset += 4;
 292   
 293                  proto_tree_add_item(dcc_opnumtree, hf_dcc_opnums_pid, tvb,
 294[+]                         offset, 4, client_is_le);
 295                  offset += 4;
 296   
 297                  proto_tree_add_item(dcc_opnumtree, hf_dcc_opnums_report, tvb,
 298                          offset, 4, client_is_le);
 299                  offset += 4;
 300   
 301                  proto_tree_add_item(dcc_opnumtree, hf_dcc_opnums_retrans, tvb,
 302[+]                         offset, 4, client_is_le);
 303                  offset += 4;
 304   
 305                  ti = proto_tree_add_text(dcc_tree, tvb, offset, -1, "Operation: %s",
 306                          val_to_str(op, dcc_op_vals, "Unknown Op: %u"));
 307                  dcc_optree = proto_item_add_subtree(ti, ett_dcc_op);
 308   
 309                  switch(op) {
 310                          case DCC_OP_NOP:
 311                                  D_SIGNATURE();
 312                                  break;
 313   
 314                          case DCC_OP_REPORT:
 315                                  D_TARGET();
 316                                  for (i=0; i<=DCC_QUERY_MAX &&
 317                                          tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++)
 318                                  {
 319                                          D_CHECKSUM();
 320                                  }
 321                                  D_SIGNATURE();
 322                                  break;
 323   
 324                          case DCC_OP_QUERY_RESP:
 325                                  for (i=0; i<=DCC_QUERY_MAX &&
 326                                          tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++)
 327                                  {
 328                                          D_TARGET();
 329                                  }
 330                                  D_SIGNATURE();
 331                                  break;
 332   
 333                          case DCC_OP_ADMN:
 334                                  if ( is_response )
 335                                  {
 336[+]                                         int left_local = tvb_length_remaining(tvb, offset) -
 337                                                  sizeof(DCC_SIGNATURE);
 338                                          if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) )
 339                                          {
 340                                                  D_LABEL("Addr", 16);
 341                                                  D_LABEL("Id", sizeof(DCC_CLNT_ID));
 342                                                  D_LABEL("Last Used", 4);
 343                                                  D_LABEL("Requests", 4);
 344                                          }
 345                                          else 
 346                                          {
 347[+][+][+]                                                 D_TEXT("Response Text", sizeof(DCC_SIGNATURE));
expand/collapse

tvb_find_line_end

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/tvbuff.c)expand/collapse
Show more  
 2444  tvb_find_line_end(tvbuff_t *tvb, gint offset, int len, gint *next_offset,
 2445      gboolean desegment)
 2446  {
 2447          gint eob_offset;
 2448          gint eol_offset;
 2449          int linelen;
 2450   
 2451          if (len == -1)
 2452                  len = tvb_length_remaining(tvb, offset);
 2453          /*
 2454           * XXX - what if "len" is still -1, meaning "offset is past the 
 2455           * end of the tvbuff"?
 2456           */
 2457          eob_offset = offset + len;
 2458   
 2459          /*
 2460           * Look either for a CR or an LF.
 2461           */
 2462[+]         eol_offset = tvb_pbrk_guint8(tvb, offset, len, (const guint8 *)"\r\n");
expand/collapse

tvb_pbrk_guint8

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/tvbuff.c)expand/collapse
Show more  
 1787  tvb_pbrk_guint8(tvbuff_t *tvb, gint offset, gint maxlength, const guint8 *needles)
 1788  {
 1789          const guint8    *result;
 1790          guint           abs_offset, junk_length;
 1791          guint           tvbufflen;
 1792          guint           limit;
 1793   
 1794          check_offset_length(tvb, offset, 0, &abs_offset, &junk_length);
 1795   
 1796          /* Only search to end of tvbuff, w/o throwing exception. */
 1797          tvbufflen = tvb_length_remaining(tvb, abs_offset);
 1798          if (maxlength == -1) {
 1799                  /* No maximum length specified; search to end of tvbuff. */
 1800                  limit = tvbufflen;
 1801          }
 1802          else if (tvbufflen < (guint) maxlength) {
Show more  
Show more  
Show more  




Change Warning 1989.32300 : Cast Alters Value

Priority:
State:
Finding:
Owner:
Note: