text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81.h
  Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193.label.xml
  Template File: sources-sink-81.tmpl.h
  */
  /*
   * @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: ncpy
   *    BadSink : Copy string to data using wcsncpy()
   * Flow Variant: 81 Data flow: data passed in a parameter to a virtual method called via a reference
   *
   * */
  
  #include "std_testcase.h"
  
  #ifndef _WIN32
  #include <wchar.h>
  #endif
  
  /* MAINTENANCE NOTE: The length of this string should equal the 10 */
  #define SRC_STRING L"AAAAAAAAAA"
  
  namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81
  {
  
  class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81_base
  {
  public:
      /* pure virtual function */
      virtual void action(wchar_t * data) const = 0;
  };
  
  #ifndef OMITBAD
  
  class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81_bad : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81_base
  {
  public:
      void action(wchar_t * data) const;
  };
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_81_base
  {
  public:
      void action(wchar_t * data) const;
  };
  
  #endif /* OMITGOOD */
  
  }
  