Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at tap-iousers.c:146

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

iousers_sctp_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/tap-iousers.c)expand/collapse
Show more  
 134  iousers_sctp_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vsctp)
 135  {
 136          io_users_t *iu=arg;
 137          const struct _sctp_info* sctph = vsctp;
 138          char name1[256],name2[256], s_sport[10], s_dport[10];
 139          io_users_item_t *iui;
 140          int direction=0;
 141   
 142          g_snprintf(s_sport, sizeof s_sport, "%d",sctph->sport);
 143          g_snprintf(s_dport, sizeof s_dport, "%d",sctph->dport);
 144   
 145          if(sctph->sport > sctph->dport) {
 146                  direction=0;
 147                  g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
 148                  g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
 149          } else if(sctph->sport < sctph->dport) {
 150                  direction=1;
 151                  g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
 152                  g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
 153          } else {
 154                  direction=0;
 155                  g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
 156                  g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
 157          }
 158   
 159          for(iui=iu->items;iui;iui=iui->next){
 160                  if((!strcmp(iui->name1, name1))
 161                   && (!strcmp(iui->name2, name2)) ){
 162                          break;
 163                  }
 164          }
 165   
 166          if(!iui){
 167                  iui=g_malloc(sizeof(io_users_item_t));
 168                  iui->next=iu->items;
 169                  iu->items=iui;
 170  /*              iui->addr1=NULL;*/
 171                  iui->name1=g_strdup(name1);
 172  /*              iui->addr2=NULL;*/
 173                  iui->name2=g_strdup(name2);
 174                  iui->frames1=0;
 175                  iui->frames2=0;
 176                  iui->bytes1=0;
 177                  iui->bytes2=0;
 178          }
 179   
 180          if(direction){
 181                  iui->frames1++;
 182                  iui->bytes1+=pinfo->fd->pkt_len;
 183          } else {
 184                  iui->frames2++;
 185                  iui->bytes2+=pinfo->fd->pkt_len;
 186          }
 187   
 188          return 1;
 189  }
Show more  




Change Warning 4865.30828 : Useless Assignment

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

Priority:
State:
Finding:
Owner:
Note: