Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at file_access.c:786

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

wtap_dump_open

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_access.c)expand/collapse
Show more  
 742  wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
 743                                  int snaplen, gboolean compressed, int *err)
 744  {
 745          wtap_dumper *wdh;
 746          FILE *fh;
 747   
 748          /* Check whether we can open a capture file with that file type
 749             and that encapsulation. */
 750[+]         if (!wtap_dump_open_check(filetype, encap, compressed, err))
 751                  return NULL;
 752   
 753          /* Allocate a data structure for the output stream. */
 754[+]         wdh = wtap_dump_alloc_wdh(filetype, encap, snaplen, compressed, err);
 755          if (wdh == NULL)
 756                  return NULL;    /* couldn't allocate it */
 757   
 758          /* "-" means stdout */
 759          if (strcmp(filename, "-") == 0) {
 760                  if(compressed) {
 761                          g_free(wdh);
 762                          return NULL;    /* compress won't work on stdout */
 763                  }
 764  #ifdef _WIN32 
 765                  setmode(fileno(stdout), O_BINARY);
 766  #endif
 767                  wdh->fh = stdout;
 768          } else {
 769                  /* In case "fopen()" fails but doesn't set "errno", set "errno"
 770                     to a generic "the open failed" error. */
 771                  errno = WTAP_ERR_CANT_OPEN;
 772[+]                 fh = wtap_dump_file_open(wdh, filename);
 773                  if (fh == NULL) {
 774                          *err = errno;
 775                          g_free(wdh);
 776                          return NULL;    /* can't create file */
 777                  }
 778                  wdh->fh = fh;
 779          }
 780   
 781[+]         if (!wtap_dump_open_finish(wdh, filetype, compressed, err)) {
 782                  /* Get rid of the file we created; we couldn't finish 
 783                     opening it. */
 784                  if (wdh->fh != stdout) {
 785                          wtap_dump_file_close(wdh);
 786                          ws_unlink(filename);
Show more  




Change Warning 12276.30222 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: