Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at reassemble.c:1035

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

fragment_add_check

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/reassemble.c)expand/collapse
Show more  
 995  fragment_data *
 996  fragment_add_check(tvbuff_t *tvb, int offset, packet_info *pinfo,
 997               guint32 id, GHashTable *fragment_table,
 998               GHashTable *reassembled_table, guint32 frag_offset,
 999               guint32 frag_data_len, gboolean more_frags)
 1000  {
 1001          reassembled_key reass_key;
 1002          fragment_key key, *new_key, *old_key;
 1003          gpointer orig_key, value;
 1004          fragment_data *fd_head;
 1005   
 1006          /*
 1007           * If this isn't the first pass, look for this frame in the table 
 1008           * of reassembled packets.
 1009           */
 1010          if (pinfo->fd->flags.visited) {
 1011                  reass_key.frame = pinfo->fd->num;
 1012                  reass_key.id = id;
 1013                  return g_hash_table_lookup(reassembled_table, &reass_key);
 1014          }
 1015   
 1016          /* create key to search hash with */
 1017          key.src = pinfo->src;
 1018          key.dst = pinfo->dst;
 1019          key.id  = id;
 1020   
 1021          if (!g_hash_table_lookup_extended(fragment_table, &key,
 1022                                            &orig_key, &value)) {
 1023                  /* not found, this must be the first snooped fragment for this 
 1024                   * packet. Create list-head.
 1025                   */
 1026                  fd_head = new_head(0);
 1027   
 1028                  /*
 1029                   * We're going to use the key to insert the fragment,
 1030                   * so allocate a structure for it, and copy the 
 1031                   * addresses, allocating new buffers for the address
 1032                   * data.
 1033                   */
 1034                  new_key = g_mem_chunk_alloc(fragment_key_chunk);
 1035                  COPY_ADDRESS(&new_key->src, &key.src);
 1036                  COPY_ADDRESS(&new_key->dst, &key.dst);
 1037                  new_key->id = key.id;
 1038                  g_hash_table_insert(fragment_table, new_key, fd_head);
 1039   
 1040                  orig_key = new_key;     /* for unhashing it later */
 1041          } else {
 1042                  /*
 1043                   * We found it.
 1044                   */
 1045                  fd_head = value;
 1046          }
 1047   
 1048          /*
 1049           * If this is a short frame, then we can't, and don't, do 
 1050           * reassembly on it.  We just give up.
 1051           */
 1052          if (tvb_reported_length(tvb) > tvb_length(tvb))
 1053                  return NULL;
 1054   
 1055          if (fragment_add_work(fd_head, tvb, offset, pinfo, frag_offset,
 1056              frag_data_len, more_frags)) {
 1057                  /*
 1058                   * Reassembly is complete.
 1059                   * Remove this from the table of in-progress
 1060                   * reassemblies, add it to the table of
 1061                   * reassembled packets, and return it.
 1062                   */
 1063   
 1064                  /*
 1065                   * Remove this from the table of in-progress reassemblies,
 1066                   * and free up any memory used for it in that table.
 1067                   */
 1068                  old_key = orig_key;
 1069                  fragment_unhash(fragment_table, old_key);
 1070   
 1071                  /*
 1072                   * Add this item to the table of reassembled packets.
 1073                   */
 1074                  fragment_reassembled(fd_head, pinfo, reassembled_table, id);
 1075                  return fd_head;
 1076          } else {
 1077                  /*
 1078                   * Reassembly isn't complete.
 1079                   */
 1080                  return NULL;
 1081          }
 1082  }
Show more  




Change Warning 1976.31227 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: