func: static void goodG2B() wchar_t * data ; data = new wchar_t [ 100 ]; wmemset ( data , L 'A' , 50 - 1 data [ 50 - 1 ] = L CWE122_Heap_Based_Buffer_Overflow__cpp_src_wchar_t_cpy_82_base * baseObject = new CWE122_Heap_Based_Buffer_Overflow__cpp_src_wchar_t_cpy_82_goodG2B baseObject -> action ( data ); void CWE122_Heap_Based_Buffer_Overflow__cpp_src_wchar_t_cpy_82_goodG2B::action(wchar_t * data) wchar_t dest [ 50 ] = L "" wcscpy ( dest , data ); 