text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE78_OS_Command_Injection__char_console_system_83_goodG2B.cpp
  Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
  Template File: sources-sink-83_goodG2B.tmpl.cpp
  */
  /*
   * @description
   * CWE: 78 OS Command Injection
   * BadSource: console Read input from the console
   * GoodSource: Fixed string
   * Sinks: system
   *    BadSink : Execute command in data using system()
   * Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack
   *
   * */
  #ifndef OMITGOOD
  
  #include "std_testcase.h"
  #include "CWE78_OS_Command_Injection__char_console_system_83.h"
  
  #ifdef _WIN32
  #define SYSTEM system
  #else /* NOT _WIN32 */
  #define SYSTEM system
  #endif
  
  namespace CWE78_OS_Command_Injection__char_console_system_83
  {
  CWE78_OS_Command_Injection__char_console_system_83_goodG2B::CWE78_OS_Command_Injection__char_console_system_83_goodG2B(char * dataCopy)
  {
      data = dataCopy;
      /* FIX: Append a fixed string to data (not user / external input) */
      strcat(data, "*.*");
  }
  
  CWE78_OS_Command_Injection__char_console_system_83_goodG2B::~CWE78_OS_Command_Injection__char_console_system_83_goodG2B()
  {
      /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */
      if (SYSTEM(data) <= 0)
      {
          printLine("command execution failed!");
          exit(1);
      }
  }
  }
  #endif /* OMITGOOD */
  