Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at dumpcap.c:885

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

cap_pipe_open_live

(/home/sate/Testcases/c/cve/wireshark-1.2.0/dumpcap.c)expand/collapse
Show more  
 825  cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
 826                   char *errmsg, int errmsgl)
 827  {
 828  #ifndef _WIN32 
 829    struct stat pipe_stat;
 830  #else
 831    char *pncopy, *pos;
 832    guint32 pre_read_word;
 833    wchar_t *err_str;
 834    HANDLE hPipe = NULL;
 835  #endif
 836    int          sel_ret;
 837    int          fd;
 838    int          b;
 839    guint32       magic;
 840    unsigned int bytes_read;
 841   
 842    g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: %s", pipename);
 843   
 844    /*
 845     * XXX (T)Wireshark blocks until we return
 846     */
 847    if (strcmp(pipename, "-") == 0) {
 848      fd = 0; /* read from stdin */
 849  #ifdef _WIN32 
 850      /*
 851       * This is needed to set the stdin pipe into binary mode, otherwise 
 852       * CR/LF are mangled...
 853       */
 854      _setmode(0, _O_BINARY);
 855  #endif  /* _WIN32 */
 856    } else {
 857  #ifndef _WIN32 
 858      if (ws_stat(pipename, &pipe_stat) < 0) {
 859        if (errno == ENOENT || errno == ENOTDIR)
 860          ld->cap_pipe_err = PIPNEXIST;
 861        else {
 862          g_snprintf(errmsg, errmsgl,
 863            "The capture session could not be initiated "
 864            "due to error on pipe: %s", strerror(errno));
 865          ld->cap_pipe_err = PIPERR;
 866        }
 867        return -1;
 868      }
 869      if (! S_ISFIFO(pipe_stat.st_mode)) {
 870        if (S_ISCHR(pipe_stat.st_mode)) {
 871          /*
 872           * Assume the user specified an interface on a system where
 873           * interfaces are in /dev.  Pretend we haven't seen it.
 874           */
 875           ld->cap_pipe_err = PIPNEXIST;
 876        } else 
 877        {
 878          g_snprintf(errmsg, errmsgl,
 879              "The capture session could not be initiated because\n"
 880              "\"%s\" is neither an interface nor a pipe", pipename);
 881          ld->cap_pipe_err = PIPERR;
 882        }
 883        return -1;
 884      }
 885      fd = ws_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
Show more  




Change Warning 5004.30115 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: