Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Computation  at libpcap.c:1059

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

libpcap_dump

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/libpcap.c)expand/collapse
Show more  
 983  static gboolean libpcap_dump(wtap_dumper *wdh,
 984          const struct wtap_pkthdr *phdr,
 985          const union wtap_pseudo_header *pseudo_header,
 986          const guchar *pd, int *err)
 987  {
 988          struct pcaprec_ss990915_hdr rec_hdr;
 989          size_t hdr_size;
 990          size_t nwritten;
 991          int phdrsize;
 992   
 993          phdrsize = pcap_get_phdr_size(wdh->encap, pseudo_header);
 994   
 995          rec_hdr.hdr.ts_sec = (guint32) phdr->ts.secs;
 996          if(wdh->tsprecision == WTAP_FILE_TSPREC_NSEC) {
 997                  rec_hdr.hdr.ts_usec = phdr->ts.nsecs;
 998          } else {
 999                  rec_hdr.hdr.ts_usec = phdr->ts.nsecs / 1000;
 1000          }
 1001          rec_hdr.hdr.incl_len = phdr->caplen + phdrsize;
 1002          rec_hdr.hdr.orig_len = phdr->len + phdrsize;
 1003          switch (wdh->file_type) {
 1004   
 1005          case WTAP_FILE_PCAP:
 1006          case WTAP_FILE_PCAP_NSEC:
 1007                  hdr_size = sizeof (struct pcaprec_hdr);
 1008                  break;
 1009   
 1010          case WTAP_FILE_PCAP_SS990417:   /* modified, but with the old magic, sigh */
 1011          case WTAP_FILE_PCAP_SS991029:
 1012                  /* XXX - what should we supply here?
 1013   
 1014                     Alexey's "libpcap" looks up the interface in the system's
 1015                     interface list if "ifindex" is non-zero, and prints
 1016                     the interface name.  It ignores "protocol", and uses
 1017                     "pkt_type" to tag the packet as "host", "broadcast",
 1018                     "multicast", "other host", "outgoing", or "none of the
 1019                     above", but that's it.
 1020   
 1021                     If the capture we're writing isn't a modified or 
 1022                     RH 6.1 capture, we'd have to do some work to
 1023                     generate the packet type and interface index - and 
 1024                     we can't generate the interface index unless we
 1025                     just did the capture ourselves in any case.
 1026   
 1027                     I'm inclined to continue to punt; systems other than 
 1028                     those with the older patch can read standard "libpcap"
 1029                     files, and systems with the older patch, e.g. RH 6.1,
 1030                     will just have to live with this. */
 1031                  rec_hdr.ifindex = 0;
 1032                  rec_hdr.protocol = 0;
 1033                  rec_hdr.pkt_type = 0;
 1034                  hdr_size = sizeof (struct pcaprec_modified_hdr);
 1035                  break;
 1036   
 1037          case WTAP_FILE_PCAP_SS990915:   /* new magic, extra crap at the end */
 1038                  rec_hdr.ifindex = 0;
 1039                  rec_hdr.protocol = 0;
 1040                  rec_hdr.pkt_type = 0;
 1041                  rec_hdr.cpu1 = 0;
 1042                  rec_hdr.cpu2 = 0;
 1043                  hdr_size = sizeof (struct pcaprec_ss990915_hdr);
 1044                  break;
 1045   
 1046          case WTAP_FILE_PCAP_NOKIA:      /* old magic, extra crap at the end */
 1047                  rec_hdr.ifindex = 0;
 1048                  rec_hdr.protocol = 0;
 1049                  rec_hdr.pkt_type = 0;
 1050                  rec_hdr.cpu1 = 0;
 1051                  rec_hdr.cpu2 = 0;
 1052                  hdr_size = sizeof (struct pcaprec_nokia_hdr);
 1053                  break;
 1054   
 1055          default:
 1056                  /* We should never get here - our open routine 
 1057                     should only get called for the types above. */
 1058                  g_assert_not_reached();
 1059                  *err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
 1060                  return FALSE;
 1061          }
 1062   
 1063          nwritten = wtap_dump_file_write(wdh, &rec_hdr, hdr_size);
 1064          if (nwritten != hdr_size) {
 1065                  if (nwritten == 0 && wtap_dump_file_ferror(wdh))
 1066                          *err = wtap_dump_file_ferror(wdh);
 1067                  else 
 1068                          *err = WTAP_ERR_SHORT_WRITE;
 1069                  return FALSE;
 1070          }
 1071          wdh->bytes_dumped += hdr_size;
 1072   
 1073          if (!pcap_write_phdr(wdh, pseudo_header, err))
 1074                  return FALSE;
 1075   
 1076          nwritten = wtap_dump_file_write(wdh, pd, phdr->caplen);
 1077          if (nwritten != phdr->caplen) {
 1078                  if (nwritten == 0 && wtap_dump_file_ferror(wdh))
 1079                          *err = wtap_dump_file_ferror(wdh);
 1080                  else 
 1081                          *err = WTAP_ERR_SHORT_WRITE;
 1082                  return FALSE;
 1083          }
 1084          wdh->bytes_dumped += phdr->caplen;
 1085          return TRUE;
 1086  }
Show more  




Change Warning 1019.30198 : Unreachable Computation

Priority:
State:
Finding:
Owner:
Note: