Text   |  XML   |  ReML   |   Visible Warnings:

Unused Value  at etherpeek.c:569

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

etherpeek_read_v56

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/etherpeek.c)expand/collapse
Show more  
 535  static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info _U_,
 536      gint64 *data_offset)
 537  {
 538          guchar ep_pkt[ETHERPEEK_V56_PKT_SIZE];
 539          guint16 length;
 540          guint16 sliceLength;
 541          guint8  flags;
 542          guint8  status;
 543          guint32 timestamp;
 544          guint16 destNum;
 545          guint16 srcNum;
 546          guint16 protoNum;
 547          char    protoStr[8];
 548          unsigned int i;
 549   
 550          /*
 551           * XXX - in order to figure out whether this packet is an
 552           * Ethernet packet or not, we have to look at the packet 
 553           * header, so we have to remember the address of the header,
 554           * not the address of the data, for random access.
 555           *
 556           * If we can determine that from the file header, rather than
 557           * the packet header, we can remember the offset of the data,
 558           * and not have the seek_read routine read the header.
 559           */
 560          *data_offset = wth->data_offset;
 561   
 562          wtap_file_read_expected_bytes(ep_pkt, sizeof(ep_pkt), wth->fh, err);
 563          wth->data_offset += sizeof(ep_pkt);
 564   
 565          /* Extract the fields from the packet */
 566          length = pntohs(&ep_pkt[ETHERPEEK_V56_LENGTH_OFFSET]);
 567          sliceLength = pntohs(&ep_pkt[ETHERPEEK_V56_SLICE_LENGTH_OFFSET]);
 568          flags = ep_pkt[ETHERPEEK_V56_FLAGS_OFFSET];
 569          status = ep_pkt[ETHERPEEK_V56_STATUS_OFFSET];
 570          timestamp = pntohl(&ep_pkt[ETHERPEEK_V56_TIMESTAMP_OFFSET]);
 571          destNum = pntohs(&ep_pkt[ETHERPEEK_V56_DESTNUM_OFFSET]);
 572          srcNum = pntohs(&ep_pkt[ETHERPEEK_V56_SRCNUM_OFFSET]);
 573          protoNum = pntohs(&ep_pkt[ETHERPEEK_V56_PROTONUM_OFFSET]);
 574          memcpy(protoStr, &ep_pkt[ETHERPEEK_V56_PROTOSTR_OFFSET],
 575              sizeof protoStr);
 576   
 577          /*
 578           * XXX - is the captured packet data padded to a multiple 
 579           * of 2 bytes?
 580           */
 581   
 582          /* force sliceLength to be the actual length of the packet */
 583          if (0 == sliceLength) {
 584                  sliceLength = length;
 585          }
 586   
 587          /* read the frame data */
 588          buffer_assure_space(wth->frame_buffer, sliceLength);
 589          wtap_file_read_expected_bytes(buffer_start_ptr(wth->frame_buffer),
 590                                        sliceLength, wth->fh, err);
 591          wth->data_offset += sliceLength;
 592   
 593          /* fill in packet header values */
 594          wth->phdr.len        = length;
 595          wth->phdr.caplen     = sliceLength;
 596          /* timestamp is in milliseconds since reference_time */
 597          wth->phdr.ts.secs  = wth->capture.etherpeek->reference_time.tv_sec
 598              + (timestamp / 1000);
 599          wth->phdr.ts.nsecs = 1000 * (timestamp % 1000) * 1000;
 600   
 601          wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN;
 602          for (i=0; i<NUM_ETHERPEEK_ENCAPS; i++) {
 603                  if (etherpeek_encap[i].protoNum == protoNum) {
 604                          wth->phdr.pkt_encap = etherpeek_encap[i].encap;
 605                  }
 606          }
 607   
 608          switch (wth->phdr.pkt_encap) {
 609   
 610          case WTAP_ENCAP_ETHERNET:
 611                  /* We assume there's no FCS in this frame. */
 612                  wth->pseudo_header.eth.fcs_len = 0;
 613                  break;
 614          }
 615          return TRUE;
 616  }
Show more  




Change Warning 999.29834 : Unused Value

Priority:
State:
Finding:
Owner:
Note: