Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at packet-ymsg.c:391

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

dissect_ymsg_pdu

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ymsg.c)expand/collapse
Show more  
 375  dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 376  {
 377          proto_tree      *ymsg_tree, *ti;
 378          proto_item      *content_item;
 379          proto_tree      *content_tree;
 380          char *keybuf;
 381          char *valbuf;
 382          int headersize = sizeof(struct yahoo_rawpacket)-6;
 383          int keylen = 0;
 384          int vallen = 0;
 385          int offset = 0;
 386          int content_len = 0;
 387   
 388          if (check_col(pinfo->cinfo, COL_PROTOCOL))
 389                  col_set_str(pinfo->cinfo, COL_PROTOCOL, "YMSG");
 390   
 391          offset = 0;
 392          if (check_col(pinfo->cinfo, COL_INFO)) {
 393                  col_add_fstr(pinfo->cinfo, COL_INFO,
 394                          "%s (status=%s)   ",
 395                          val_to_str(tvb_get_ntohs(tvb, offset + 10),
 396                                   ymsg_service_vals, "Unknown Service: %u"),
 397                          val_to_str(tvb_get_ntohl(tvb, offset + 12),
 398                                   ymsg_status_vals, "Unknown Status: %u")
 399                  );
 400          }
 401   
 402          if (tree) {
 403                  ti = proto_tree_add_item(tree, proto_ymsg, tvb, offset, -1, FALSE);
 404                  ymsg_tree = proto_item_add_subtree(ti, ett_ymsg);
 405   
 406                  offset += 4; /* skip the YMSG string */
 407   
 408                  /* Version */
 409                  proto_tree_add_item(ymsg_tree, hf_ymsg_version, tvb, offset, 2, FALSE);
 410                  offset += 2;
 411   
 412                  offset += 2;    /* XXX - padding? */
 413   
 414                  /* Length */
 415                  content_len = tvb_get_ntohs(tvb, offset);
 416                  proto_tree_add_item(ymsg_tree, hf_ymsg_len, tvb, offset, 2, FALSE);
 417                  offset += 2;
 418   
 419                  /* Service */
 420                  proto_item_append_text(ti, " (%s)",
 421                                         val_to_str(tvb_get_ntohs(tvb, offset),
 422                                                    ymsg_service_vals,
 423                                                    "Unknown"));
 424   
 425                  proto_tree_add_item(ymsg_tree, hf_ymsg_service, tvb, offset, 2, FALSE);
 426                  offset += 2;
 427   
 428                  /* Status */
 429                  proto_tree_add_item(ymsg_tree, hf_ymsg_status, tvb, offset, 4, FALSE);
 430                  offset += 4;
 431   
 432                  /* Session id */
 433                  proto_tree_add_item(ymsg_tree, hf_ymsg_session_id, tvb, offset, 4, TRUE);
 434                  offset += 4;
 435   
 436                  /* Contents */
 437                  if (content_len) {
 438                          /* Create content subtree */
 439                          content_item = proto_tree_add_item(ymsg_tree, hf_ymsg_content, tvb,
 440                                                             offset, -1, TRUE);
 441                          content_tree = proto_item_add_subtree(content_item, ett_ymsg_content);
 442   
 443                          /* Each entry consists of:
 444                             <key string> <delimiter> <value string> <delimiter>
 445                          */
 446                           
 447                          /* Parse and show each line of the contents */
 448                          for (;;)
 449                          {
 450                                  proto_item  *ti = NULL;
 451                                  proto_tree  *content_line_tree = NULL;
 452                                   
 453                                  /* Don't continue unless there is room for another whole item.
 454                                     (including 2 2-byte delimiters */
 455                                  if (offset >= (headersize+content_len-4))
 456                                  {
 457                                          break;
 458                                  }
 459                                   
 460                                  /* Get the length of the key */
 461                                  keylen = get_content_item_length(tvb, offset);
 462                                  /* Extract the key */
 463                                  keybuf = tvb_format_text(tvb, offset, keylen);
 464   
 465                                  /* Get the length of the value */
 466                                  vallen = get_content_item_length(tvb, offset+keylen+2);
 467                                  /* Extract the value */
 468                                  valbuf = tvb_format_text(tvb, offset+keylen+2, vallen);
 469   
 470                                  /* Add a text item with the key... */
 471                                  ti =  proto_tree_add_string_format(content_tree, hf_ymsg_content_line, tvb,
 472                                                                     offset, keylen+2+vallen+2,
 473                                                                     "", "%s:%s", keybuf, valbuf);
 474                                  content_line_tree = proto_item_add_subtree(ti, ett_ymsg_content_line);
 475   
 476                                  /* And add the key and value separately inside */
 477                                  proto_tree_add_item(content_line_tree, hf_ymsg_content_line_key, tvb,
 478                                                      offset, keylen, FALSE);
 479                                  proto_tree_add_item(content_line_tree, hf_ymsg_content_line_value, tvb,
 480                                                      offset+keylen+2, vallen, FALSE);
 481   
 482                                  /* Move beyone key and value lines */
 483                                  offset += keylen+2+vallen+2;
 484                          }
 485                  }
 486          }
 487   
 488          col_set_fence(pinfo->cinfo, COL_INFO);
 489   
 490          return;
 491  }
Show more  




Change Warning 3087.32701 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: