text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_declare_snprintf_81_bad.cpp
  Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE806.label.xml
  Template File: sources-sink-81_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 121 Stack Based Buffer Overflow
   * BadSource:  Initialize data as a large string
   * GoodSource: Initialize data as a small string
   * Sinks: swprintf
   *    BadSink : Copy data to string using swprintf
   * 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 "CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_declare_snprintf_81.h"
  
  #ifdef _WIN32
  #define SNPRINTF _snwprintf
  #else
  #define SNPRINTF swprintf
  #endif
  
  namespace CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_declare_snprintf_81
  {
  
  void CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_declare_snprintf_81_bad::action(wchar_t * data) const
  {
      {
          wchar_t dest[50] = L"";
          /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
          SNPRINTF(dest, wcslen(data), L"%s", data);
          printWLine(data);
      }
  }
  
  }
  #endif /* OMITBAD */
  