text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE23_Relative_Path_Traversal__wchar_t_connect_socket_open_81_bad.cpp
  Label Definition File: CWE23_Relative_Path_Traversal.label.xml
  Template File: sources-sink-81_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 23 Relative Path Traversal
   * BadSource: connect_socket Read data using a connect socket (client side)
   * GoodSource: Use a fixed file name
   * Sinks: open
   *    BadSink : Open the file named in data using open()
   * Flow Variant: 81 Data flow: data passed in a parameter to a virtual method called via a reference
   *
   * */
  #ifndef OMITBAD
  
  #include "std_testcase.h"
  #include "CWE23_Relative_Path_Traversal__wchar_t_connect_socket_open_81.h"
  
  #ifdef _WIN32
  #define OPEN _wopen
  #define CLOSE _close
  #else
  #include <unistd.h>
  #define OPEN open
  #define CLOSE close
  #endif
  
  namespace CWE23_Relative_Path_Traversal__wchar_t_connect_socket_open_81
  {
  
  void CWE23_Relative_Path_Traversal__wchar_t_connect_socket_open_81_bad::action(wchar_t * data) const
  {
      {
          int fileDesc;
          /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
          fileDesc = OPEN(data, O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
          if (fileDesc != -1)
          {
              CLOSE(fileDesc);
          }
      }
  }
  
  }
  #endif /* OMITBAD */
  