# this list was borrowed, with gratitude, from Flawfinder:
# http://sourceforge.net/projects/flawfinder/

# @todo: I'm not an expert at C. It would be great to break up this list
# into more granular signature groups.
$signatures[:cpp] ||= {}
$signatures[:cpp][:dangerous_functions] = [
	Signature.new({:literal => 'strcpy'}),
	Signature.new({:literal => 'lstrcpy'}),
	Signature.new({:literal => 'wcscpy'}),
	Signature.new({:literal => '_tcscpy'}),
	Signature.new({:literal => '_mbscpy'}),
	Signature.new({:literal => 'memcpy'}),
	Signature.new({:literal => 'CopyMemory'}),
	Signature.new({:literal => 'bcopy'}),
	Signature.new({:literal => 'strcat'}),
	Signature.new({:literal => 'lstrcat'}),
	Signature.new({:literal => 'wcscat'}),
	Signature.new({:literal => '_tcscat'}),
	Signature.new({:literal => '_mbscat'}),
	Signature.new({:literal => 'strncpy'}),
	Signature.new({:literal => 'lstrcpyn'}),
	Signature.new({:literal => 'wcsncpy'}),
	Signature.new({:literal => '_tcsncpy'}),
	Signature.new({:literal => '_mbsnbcpy'}),
	Signature.new({:literal => 'strncat'}),
	Signature.new({:literal => 'lstrcatn'}),
	Signature.new({:literal => 'wcsncat'}),
	Signature.new({:literal => '_tcsncat'}),
	Signature.new({:literal => '_mbsnbcat'}),
	Signature.new({:literal => 'strccpy'}),
	Signature.new({:literal => 'strcadd'}),
	Signature.new({:literal => 'gets'}),
	Signature.new({:literal => '_getts'}),
	Signature.new({:literal => 'sprintf'}),
	Signature.new({:literal => 'vsprintf'}),
	Signature.new({:literal => 'swprintf'}),
	Signature.new({:literal => 'vswprintf'}),
	Signature.new({:literal => 'vswprintf'}),
	Signature.new({:literal => '_stprintf'}),
	Signature.new({:literal => '_vstprintf'}),
	Signature.new({:literal => 'printf'}),
	Signature.new({:literal => 'vprintf'}),
	Signature.new({:literal => 'vwprintf'}),
	Signature.new({:literal => 'vfwprintf'}),
	Signature.new({:literal => '_vtprintf'}),
	Signature.new({:literal => 'fprintf'}),
	Signature.new({:literal => 'vfprintf'}),
	Signature.new({:literal => '_ftprintf'}),
	Signature.new({:literal => '_vftprintf'}),
	Signature.new({:literal => 'syslog'}),
	Signature.new({:literal => 'snprintf'}),
	Signature.new({:literal => 'vsnprintf'}),
	Signature.new({:literal => '_snprintf'}),
	Signature.new({:literal => '_sntprintf'}),
	Signature.new({:literal => '_vsntprintf'}),
	Signature.new({:literal => 'scanf'}),
	Signature.new({:literal => 'vscanf'}),
	Signature.new({:literal => 'wscanf'}),
	Signature.new({:literal => '_tscanf'}),
	Signature.new({:literal => 'fscanf'}),
	Signature.new({:literal => 'sscanf'}),
	Signature.new({:literal => 'vsscanf'}),
	Signature.new({:literal => 'vfscanf'}),
	Signature.new({:literal => '_ftscanf'}),
	Signature.new({:literal => 'strlen'}),
	Signature.new({:literal => 'wcslen'}),
	Signature.new({:literal => '_tcslen'}),
	Signature.new({:literal => '_mbslen'}),
	Signature.new({:literal => 'streadd'}),
	Signature.new({:literal => 'strecpy'}),
	Signature.new({:literal => 'strtrns'}),
	Signature.new({:literal => 'realpath'}),
	Signature.new({:literal => 'realpath'}),
	Signature.new({:literal => 'getopt'}),
	Signature.new({:literal => 'getopt_long'}),
	Signature.new({:literal => 'getpass'}),
	Signature.new({:literal => 'getwd'}),
	Signature.new({:literal => 'getchar'}),
	Signature.new({:literal => 'fgetc'}),
	Signature.new({:literal => 'getc'}),
	Signature.new({:literal => 'read'}),
	Signature.new({:literal => '_gettc'}),
	Signature.new({:literal => 'chown'}),
	Signature.new({:literal => 'chgrp'}),
	Signature.new({:literal => 'chmod'}),
	Signature.new({:literal => 'vfork'}),
	Signature.new({:literal => 'readlink'}),
	Signature.new({:literal => 'tmpfile'}),
	Signature.new({:literal => 'tmpnam'}),
	Signature.new({:literal => 'tempnam'}),
	Signature.new({:literal => 'mktemp'}),
	Signature.new({:literal => 'mkstemp'}),
	Signature.new({:literal => 'fopen'}),
	Signature.new({:literal => 'open'}),
	Signature.new({:literal => 'umask'}),
	Signature.new({:literal => 'umask'}),
	Signature.new({:literal => 'GetTempFileName'}),
	Signature.new({:literal => 'execl'}),
	Signature.new({:literal => 'execlp'}),
	Signature.new({:literal => 'execle'}),
	Signature.new({:literal => 'execv'}),
	Signature.new({:literal => 'execvp'}),
	Signature.new({:literal => 'system'}),
	Signature.new({:literal => 'popen'}),
	Signature.new({:literal => 'WinExec'}),
	Signature.new({:literal => 'ShellExecute'}),
	Signature.new({:literal => 'execl'}),
	Signature.new({:literal => 'execlp'}),
	Signature.new({:literal => 'execle'}),
	Signature.new({:literal => 'execv'}),
	Signature.new({:literal => 'execvp'}),
	Signature.new({:literal => 'execvp'}),
	Signature.new({:literal => 'system'}),
	Signature.new({:literal => 'popen'}),
	Signature.new({:literal => 'WinExec'}),
	Signature.new({:literal => 'ShellExecute'}),
	Signature.new({:literal => 'CreateProcessAsUser'}),
	Signature.new({:literal => 'CreateProcessWithLogon'}),
	Signature.new({:literal => 'CreateProcess'}),
	Signature.new({:literal => 'atoi'}),
	Signature.new({:literal => 'atol'}),
	Signature.new({:literal => 'atol'}),
	Signature.new({:literal => 'drand48'}),
	Signature.new({:literal => 'erand48'}),
	Signature.new({:literal => 'jrand48'}),
	Signature.new({:literal => 'lcong48'}),
	Signature.new({:literal => 'lrand48'}),
	Signature.new({:literal => 'mrand48'}),
	Signature.new({:literal => 'nrand48'}),
	Signature.new({:literal => 'random'}),
	Signature.new({:literal => 'seed48'}),
	Signature.new({:literal => 'setstate'}),
	Signature.new({:literal => 'srand'}),
	Signature.new({:literal => 'srandom'}),
	Signature.new({:literal => 'crypt'}),
	Signature.new({:literal => 'EVP_des_ecb'}),
	Signature.new({:literal => 'EVP_des_cbc'}),
	Signature.new({:literal => 'EVP_des_cfb'}),
	Signature.new({:literal => 'EVP_des_ofb'}),
	Signature.new({:literal => 'EVP_desx_cbc'}),
	Signature.new({:literal => 'EVP_rc4_40'}),
	Signature.new({:literal => 'EVP_rc2_40_cbc'}),
	Signature.new({:literal => 'EVP_rc2_64_cbc'}),
	Signature.new({:literal => 'chroot'}),
	Signature.new({:literal => 'getenv'}),
	Signature.new({:literal => 'curl_getenv'}),
	Signature.new({:literal => 'g_get_home_dir'}),
	Signature.new({:literal => 'g_get_tmp_dir'}),
	Signature.new({:literal => 'SetThreadToken'}),
	Signature.new({:literal => 'InitializeCriticalSection'}),
	Signature.new({:literal => 'EnterCriticalSection'}),
	Signature.new({:literal => 'LoadLibrary'}),
	Signature.new({:literal => 'LoadLibraryEx'}),
	Signature.new({:literal => 'SetSecurityDescriptorDacl'}),
	Signature.new({:literal => 'AddAccessAllowedAce'}),
	Signature.new({:literal => 'getlogin'}),
	Signature.new({:literal => 'cuserid'}),
	Signature.new({:literal => 'getpw'}),
	Signature.new({:literal => 'getpass'}),
	Signature.new({:literal => 'gsignal'}),
	Signature.new({:literal => 'ssignal'}),
	Signature.new({:literal => 'memalign'}),
	Signature.new({:literal => 'ulimit'}),
	Signature.new({:literal => 'usleep'}),
	Signature.new({:literal => 'recv'}),
	Signature.new({:literal => 'recvfrom'}),
	Signature.new({:literal => 'recvmsg'}),
	Signature.new({:literal => 'fread'}),
	Signature.new({:literal => 'readv'}),
]
