text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_82_bad.cpp
  Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE131.label.xml
  Template File: sources-sink-82_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 121 Stack Based Buffer Overflow
   * BadSource:  Allocate memory without using sizeof(int)
   * GoodSource: Allocate memory using sizeof(int)
   * Sinks: memcpy
   *    BadSink : Copy array to data using memcpy()
   * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
   *
   * */
  #ifndef OMITBAD
  
  #include "std_testcase.h"
  #include "CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_82.h"
  
  namespace CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_82
  {
  
  void CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_82_bad::action(int * data)
  {
      {
          int source[10] = {0};
          /* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
          memcpy(data, source, 10*sizeof(int));
          printIntLine(data[0]);
      }
  }
  
  }
  #endif /* OMITBAD */
  