text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53b.c
  Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml
  Template File: sources-sink-53b.tmpl.c
  */
  /*
   * @description
   * CWE: 427 Uncontrolled Search Path Element
   * BadSource: fromFile Read input from a file
   * GoodSource: Use a hardcoded path
   * Sink:
   *    BadSink : Set the environment variable
   * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #include <wchar.h>
  
  #ifdef _WIN32
  # define NEW_PATH L"%SystemRoot%\\system32"
  # define PUTENV _wputenv
  #else
  # define NEW_PATH L"/bin"
  # define PUTENV wputenv
  #endif
  
  #ifdef _WIN32
  # define FOPEN _wfopen
  #else
  /* fopen is used on unix-based OSs */
  # define FOPEN fopen
  #endif
  
  /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
  
  #ifndef OMITBAD
  
  /* bad function declaration */
  void CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53c_bad_sink(wchar_t * data);
  
  void CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53b_bad_sink(wchar_t * data)
  {
      CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53c_bad_sink(data);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* good function declaration */
  void CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53c_goodG2B_sink(wchar_t * data);
  
  /* goodG2B uses the GoodSource with the BadSink */
  void CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53b_goodG2B_sink(wchar_t * data)
  {
      CWE427_Uncontrolled_Search_Path_Element__wchar_t_fromFile_53c_goodG2B_sink(data);
  }
  
  #endif /* OMITGOOD */
  