func: static void goodB2G() size_t data ; data = 0; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G * goodB2GObject = new CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G ( data ) ; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G::CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G(size_t dataCopy) data = dataCopy; char inputBuffer [ CHAR_ARRAY_SIZE ] = "" ; if ( fgets ( inputBuffer , CHAR_ARRAY_SIZE , stdin ) != NULL )  data = strtoul ( inputBuffer , NULL , 0 ); printLine ( "fgets() failed." ); delete goodB2GObject CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G::~CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fgets_84_goodB2G() wchar_t * myString ; if ( data > wcslen ( HELLO_STRING ) && data < 100 )  myString = ( wchar_t * ) malloc ( data * sizeof ( wchar_t ) ); wcscpy ( myString , HELLO_STRING ); printWLine ( myString ); void printWLine (const wchar_t * line) if ( line != NULL )  wprintf ( L "%ls\n" , line ) free ( myString ); 