text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_82_goodG2B.cpp
  Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml
  Template File: sources-sink-82_goodG2B.tmpl.cpp
  */
  /*
   * @description
   * CWE: 124 Buffer Underwrite
   * BadSource:  Set data pointer to before the allocated memory buffer
   * GoodSource: Set data pointer to the allocated memory buffer
   * Sinks: cpy
   *    BadSink : Copy string to data using wcscpy
   * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
   *
   * */
  #ifndef OMITGOOD
  
  #include "std_testcase.h"
  #include "CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_82.h"
  
  namespace CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_82
  {
  
  void CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_82_goodG2B::action(wchar_t * data)
  {
      {
          wchar_t source[100];
          wmemset(source, L'C', 100-1); /* fill with 'C's */
          source[100-1] = L'\0'; /* null terminate */
          /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */
          wcscpy(data, source);
          printWLine(data);
      }
  }
  
  }
  #endif /* OMITGOOD */
  