Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Call  at catapult_dct2000.c:722

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

catapult_dct2000_dump

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/catapult_dct2000.c)expand/collapse
Show more  
 604  gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
 605                                 const union wtap_pseudo_header *pseudo_header,
 606                                 const guchar *pd, int *err)
 607  {
 608      guint32 n;
 609      line_prefix_info_t *prefix = NULL;
 610      gchar time_string[16];
 611   
 612      /******************************************************/
 613      /* Look up the file_externals structure for this file */
 614      /* Find wtap external structure for this wtap */
 615      dct2000_file_externals_t *file_externals =
 616          (dct2000_file_externals_t*)g_hash_table_lookup(file_externals_table,
 617                                                         pseudo_header->dct2000.wth);
 618   
 619      if (wdh->dump.dct2000 == NULL)
 620      {
 621          /* Allocate the dct2000-specific dump structure */
 622          wdh->dump.dct2000 = g_malloc(sizeof(catapult_dct2000_t));
 623   
 624          /* Write out saved first line */
 625          if (! do_fwrite(file_externals->firstline, 1, file_externals->firstline_length, wdh->fh, err))
 626          {
 627              return FALSE;
 628          }
 629          if (! do_fwrite("\n", 1, 1, wdh->fh, err))
 630          {
 631              return FALSE;
 632          }
 633   
 634          /* Also write out saved second line with timestamp corresponding to the 
 635             opening time of the log.
 636          */
 637          if (! do_fwrite(file_externals->secondline, 1, file_externals->secondline_length, wdh->fh, err))
 638          {
 639              return FALSE;
 640          }
 641          if (! do_fwrite("\n", 1, 1, wdh->fh, err))
 642          {
 643              return FALSE;
 644          }
 645   
 646          /* Allocate the dct2000-specific dump structure */
 647          wdh->dump.dct2000 = g_malloc(sizeof(catapult_dct2000_t));
 648   
 649          /* Copy time of beginning of file */
 650          wdh->dump.dct2000->start_time.secs =
 651              pseudo_header->dct2000.wth->capture.catapult_dct2000->start_secs;
 652          wdh->dump.dct2000->start_time.nsecs =
 653              (pseudo_header->dct2000.wth->capture.catapult_dct2000->start_usecs * 1000);
 654   
 655          /* Set flag do don't write header out again */
 656          wdh->dump.dct2000->first_packet_written = TRUE;
 657      }
 658   
 659   
 660      /******************************************************************/
 661      /* Write out this packet's prefix, including calculated timestamp */
 662   
 663      /* Look up line data prefix using stored offset */
 664      prefix = (line_prefix_info_t*)g_hash_table_lookup(file_externals->packet_prefix_table,
 665                                                        (const void*)&(pseudo_header->dct2000.seek_off));
 666   
 667      /* Write out text before timestamp */
 668      if (! do_fwrite(prefix->before_time, 1, strlen(prefix->before_time), wdh->fh, err))
 669      {
 670          return FALSE;
 671      }
 672   
 673      /* Calculate time of this packet to write, relative to start of dump */
 674      if (phdr->ts.nsecs >= wdh->dump.dct2000->start_time.nsecs)
 675      {
 676          g_snprintf(time_string, 16, "%ld.%04d",
 677                   (long)(phdr->ts.secs - wdh->dump.dct2000->start_time.secs),
 678                   (phdr->ts.nsecs - wdh->dump.dct2000->start_time.nsecs) / 100000);
 679      }
 680      else 
 681      {
 682          g_snprintf(time_string, 16, "%ld.%04u",
 683                   (long)(phdr->ts.secs - wdh->dump.dct2000->start_time.secs-1),
 684                   ((1000000000 + (phdr->ts.nsecs / 100000)) - (wdh->dump.dct2000->start_time.nsecs / 100000)) % 10000);
 685      }
 686   
 687      /* Write out the calculated timestamp */
 688      if (! do_fwrite(time_string, 1, strlen(time_string), wdh->fh, err))
 689      {
 690          return FALSE;
 691      }
 692   
 693      /* Write out text between timestamp and start of hex data */
 694      if (prefix->after_time == NULL)
 695      {
 696          if (! do_fwrite(" l ", 1, strlen(" l "), wdh->fh, err))
 697          {
 698              return FALSE;
 699          }
 700      }
 701      else 
 702      {
 703          if (! do_fwrite(prefix->after_time, 1, strlen(prefix->after_time), wdh->fh, err))
 704          {
 705              return FALSE;
 706          }
 707      }
 708   
 709   
 710      /****************************************************************/
 711      /* Need to skip stub header at start of pd before we reach data */
 712   
 713      /* Context name */
 714      for (n=0; pd[n] != '\0'; n++);
 715      n++;
 716   
 717      /* Context port number */
 718      n++;
 719   
 720      /* Timestamp */
 721      for (; pd[n] != '\0'; n++);
 722      n++;
 723   
 724      /* Protocol name */
 725      for (; pd[n] != '\0'; n++);
 726      n++;
 727   
 728      /* Variant number (as string) */
 729      for (; pd[n] != '\0'; n++);
 730      n++;
 731   
 732      /* Outhdr (as string) */
 733      for (; pd[n] != '\0'; n++);
 734      n++;
 735   
 736      /* Direction & encap */
 737      n += 2;
 738   
 739   
 740      /**************************************/
 741      /* Remainder is encapsulated protocol */
 742      if (! do_fwrite("$", 1, 1, wdh->fh, err))
 743      {
 744          return FALSE;
 745      }
 746   
 747      /* Each binary byte is written out as 2 hex string chars */  
 748      for (; n < phdr->len; n++)
 749      {
 750          gchar c[2];
 751          c[0] = char_from_hex((guchar)(pd[n] >> 4));
 752          c[1] = char_from_hex((guchar)(pd[n] & 0x0f));
 753   
 754          /* Write both hex chars of byte together */
 755          if (! do_fwrite(c, 1, 2, wdh->fh, err))
 756          {
 757              return FALSE;
 758          }
 759      }
 760   
 761      /* End the line */
 762      if (! do_fwrite("\n", 1, 1, wdh->fh, err))
 763      {
 764          return FALSE;
 765      }
 766   
 767      return TRUE;
 768  }
Show more  




Change Warning 969.30038 : Unreachable Call

Priority:
State:
Finding:
Owner:
Note: