text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_81_bad.cpp
  Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
  Template File: sources-sink-81_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 122 Heap Based Buffer Overflow
   * BadSource:  Allocate memory for a string, but do not allocate space for NULL terminator
   * GoodSource: Allocate enough memory for a string and the NULL terminator
   * Sinks: cpy
   *    BadSink : Copy string to data using wcscpy()
   * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
   *
   * */
  #ifndef OMITBAD
  
  #include "std_testcase.h"
  #include "CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_81.h"
  
  namespace CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_81
  {
  
  void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_wchar_t_cpy_81_bad::action(wchar_t * data) const
  {
      {
          wchar_t source[10+1] = SRC_STRING;
          /* POTENTIAL FLAW: data may not have enough space to hold source */
          wcscpy(data, source);
          printWLine(data);
          free(data);
      }
  }
  
  }
  #endif /* OMITBAD */
  