text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_ncpy_53c.cpp
  Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml
  Template File: sources-sink-53c.tmpl.cpp
  */
  /*
   * @description
   * CWE: 122 Heap Based Buffer Overflow
   * BadSource:  Initialize data as a large string
   * GoodSource: Initialize data as a small string
   * Sink: ncpy
   *    BadSink : Copy data to string using strncpy
   * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #include <wchar.h>
  
  namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_ncpy_53
  {
  
  /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
  
  #ifndef OMITBAD
  
  /* bad function declaration */
  void badSink_d(char * data);
  
  void badSink_c(char * data)
  {
      badSink_d(data);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2BSink_d(char * data);
  
  void goodG2BSink_c(char * data)
  {
      goodG2BSink_d(data);
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  