text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE78_OS_Command_Injection__char_fromFile_execvp_52b.c
  Label Definition File: CWE78_OS_Command_Injection.no_path.label.xml
  Template File: sources-sink-52b.tmpl.c
  */
  /*
   * @description
   * CWE: 78 OS Command Injection
   * BadSource: fromFile Read input from a file
   * GoodSource: Benign input
   * Sink: execvp
   *    BadSink : execute command with execvp
   * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #include <wchar.h>
  
  #ifdef _WIN32
  # define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
  # define COMMAND_INT "cmd.exe"
  # define COMMAND_ARG1 "/c"
  # define COMMAND_ARG2 "dir"
  # define COMMAND_ARG3 data
  #else /* NOT _WIN32 */
  # define COMMAND_INT_PATH "/bin/sh"
  # define COMMAND_INT "sh"
  # define COMMAND_ARG1 "ls"
  # define COMMAND_ARG2 data
  # define COMMAND_ARG3 NULL
  #endif
  
  #ifdef _WIN32
  # define FOPEN fopen
  #else
  /* fopen is used on unix-based OSs */
  # define FOPEN fopen
  #endif
  
  #ifdef _WIN32
  #include <process.h>
  # define EXECVP _execvp
  #else /* NOT _WIN32 */
  # define EXECVP execvp
  #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 CWE78_OS_Command_Injection__char_fromFile_execvp_52c_bad_sink(char * data);
  
  void CWE78_OS_Command_Injection__char_fromFile_execvp_52b_bad_sink(char * data)
  {
      CWE78_OS_Command_Injection__char_fromFile_execvp_52c_bad_sink(data);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* good function declaration */
  void CWE78_OS_Command_Injection__char_fromFile_execvp_52c_goodG2B_sink(char * data);
  
  /* goodG2B uses the GoodSource with the BadSink */
  void CWE78_OS_Command_Injection__char_fromFile_execvp_52b_goodG2B_sink(char * data)
  {
      CWE78_OS_Command_Injection__char_fromFile_execvp_52c_goodG2B_sink(data);
  }
  
  #endif /* OMITGOOD */
  