Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/open-invaders-0.3/headers/logic.h Examining data/open-invaders-0.3/headers/collision.h Examining data/open-invaders-0.3/headers/input.h Examining data/open-invaders-0.3/headers/main.h Examining data/open-invaders-0.3/headers/init.h Examining data/open-invaders-0.3/headers/interrupt.h Examining data/open-invaders-0.3/headers/unlock.h Examining data/open-invaders-0.3/headers/sound.h Examining data/open-invaders-0.3/headers/graphics.h Examining data/open-invaders-0.3/headers/ending.h Examining data/open-invaders-0.3/headers/intro.h Examining data/open-invaders-0.3/headers/declare.h Examining data/open-invaders-0.3/headers/pmask.h Examining data/open-invaders-0.3/src/main.cc Examining data/open-invaders-0.3/src/unlock.cc Examining data/open-invaders-0.3/src/intro.cc Examining data/open-invaders-0.3/src/collision.cc Examining data/open-invaders-0.3/src/logic.cc Examining data/open-invaders-0.3/src/sound.cc Examining data/open-invaders-0.3/src/input.cc Examining data/open-invaders-0.3/src/interrupt.cc Examining data/open-invaders-0.3/src/pmask.c Examining data/open-invaders-0.3/src/graphics.cc Examining data/open-invaders-0.3/src/ending.cc Examining data/open-invaders-0.3/src/init.cc FINAL RESULTS: data/open-invaders-0.3/src/intro.cc:310:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(hiscore_names[hiscoremove+1],hiscore_names[hiscoremove]); data/open-invaders-0.3/src/init.cc:182:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. filepath << getenv("HOME") << "/.openinvaders/hiscore"; data/open-invaders-0.3/src/init.cc:303:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. filepath << getenv("HOME") << "/.openinvaders"; data/open-invaders-0.3/src/init.cc:336:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. filepath << getenv("HOME") << "/.openinvaders"; data/open-invaders-0.3/src/init.cc:490:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. filepath << getenv("HOME") << "/.openinvaders"; data/open-invaders-0.3/src/init.cc:547:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(unsigned(time(0))); data/open-invaders-0.3/src/input.cc:59:19: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. string filepath=getenv("HOME"); data/open-invaders-0.3/src/init.cc:42:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. extern char hiscore_names[10][4]; data/open-invaders-0.3/src/init.cc:186:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char teststring[5]; data/open-invaders-0.3/src/init.cc:191:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). hiscorefile.open(filepath.str().c_str(),ios::binary); data/open-invaders-0.3/src/init.cc:269:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[0],"DAZ"); data/open-invaders-0.3/src/init.cc:270:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[1],"YIK"); data/open-invaders-0.3/src/init.cc:271:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[2],"IST"); data/open-invaders-0.3/src/init.cc:272:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[3],"BOB"); data/open-invaders-0.3/src/init.cc:273:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[4],"ROB"); data/open-invaders-0.3/src/init.cc:274:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[5],"ZED"); data/open-invaders-0.3/src/init.cc:275:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[6],"GUM"); data/open-invaders-0.3/src/init.cc:276:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[7],"LDP"); data/open-invaders-0.3/src/init.cc:277:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[8],"RAM"); data/open-invaders-0.3/src/init.cc:278:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[9],"JAY"); data/open-invaders-0.3/src/init.cc:309:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). hiscorefile.open(filepath.str().c_str(),ios::binary); data/open-invaders-0.3/src/init.cc:348:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). configfile.open(filepath.str().c_str(),ios::binary); data/open-invaders-0.3/src/init.cc:373:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). difficulty=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:396:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). music_volume=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:405:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). sfx_volume=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:414:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[0]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:423:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[1]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:432:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[2]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:441:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[3]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:450:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[4]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:459:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[5]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:468:21: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). keysdefined[6]=atoi(value.c_str()); data/open-invaders-0.3/src/init.cc:496:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). configfile.open(filepath.str().c_str(),ios::binary); data/open-invaders-0.3/src/intro.cc:49:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. extern char hiscore_names[10][4]; data/open-invaders-0.3/src/intro.cc:171:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char charbuf[2]; data/open-invaders-0.3/src/intro.cc:313:4: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(hiscore_names[hiscorecheck]," "); data/open-invaders-0.3/src/logic.cc:55:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char hiscore_names[10][4]; data/open-invaders-0.3/src/pmask.c:32:49: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. #define COMPILE_TIME_ASSERT(condition) {typedef char _compile_time_assert__[(condition) ? 1 : -1];} data/open-invaders-0.3/src/init.cc:193:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). hiscorefile.read(teststring,4); data/open-invaders-0.3/src/init.cc:223:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). hiscorefile.read(reinterpret_cast<char*>(&hiscore_names[readhiscores]),4); data/open-invaders-0.3/src/init.cc:224:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). hiscorefile.read(reinterpret_cast<char*>(&hiscore[readhiscores]),sizeof(hiscore[0])); data/open-invaders-0.3/src/init.cc:235:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). hiscorefile.read(reinterpret_cast<char*>(&checksum),sizeof(checksum)); data/open-invaders-0.3/src/init.cc:241:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). hiscorefile.read(reinterpret_cast<char*>(&unlockables_unlocked[readunlockables]),sizeof(unlockables_unlocked[readunlockables])); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 6999 in approximately 0.21 seconds (33332 lines/second) Physical Source Lines of Code (SLOC) = 5328 Hits@level = [0] 0 [1] 5 [2] 31 [3] 6 [4] 1 [5] 0 Hits@level+ = [0+] 43 [1+] 43 [2+] 38 [3+] 7 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 8.07057 [1+] 8.07057 [2+] 7.13213 [3+] 1.31381 [4+] 0.187688 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.