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/pacman4console-1.3/pacmanedit.c Examining data/pacman4console-1.3/debian/patches/pacman.c Examining data/pacman4console-1.3/pacman.c Examining data/pacman4console-1.3/pacman.h FINAL RESULTS: data/pacman4console-1.3/pacmanedit.c:60:9: [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(filename, argv[1]); //Copy command line parameter into string data/pacman4console-1.3/debian/patches/pacman.c:81:6: [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( NULL ) ); data/pacman4console-1.3/pacman.c:111:5: [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( NULL ) ); data/pacman4console-1.3/debian/patches/pacman.c:46:21: [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. int main(int argc, char *argv[100]) { data/pacman4console-1.3/debian/patches/pacman.c:142:40: [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. @@ -125,7 +155,7 @@ int main(int argc, char *argv[100]) { data/pacman4console-1.3/debian/patches/pacman.c:215:17: [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. -void LoadLevel(char levelfile[100]) { data/pacman4console-1.3/debian/patches/pacman.c:220:36: [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. @@ -555,7 +614,7 @@ void LoadLevel(char levelfile[100]) { data/pacman4console-1.3/pacman.c:77:20: [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. int main(int argc, char *argv[100]) { data/pacman4console-1.3/pacman.c:560:5: [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 error[sizeof(LEVEL_ERR)+255] = LEVEL_ERR; //Let's assume an error data/pacman4console-1.3/pacman.c:572:15: [2] (misc) fopen: 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). fin = fopen(levelfile, "r"); data/pacman4console-1.3/pacmanedit.c:25:18: [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. void ExitProgram(char message[255]); //Exit gracefully data/pacman4console-1.3/pacmanedit.c:47: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 filename[255] = ""; //Name of file to load/save data/pacman4console-1.3/pacmanedit.c:55:20: [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. int main(int argc, char *argv[100]) { data/pacman4console-1.3/pacmanedit.c:166:18: [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. void ExitProgram(char message[255]) { data/pacman4console-1.3/pacmanedit.c:331:11: [2] (misc) fopen: 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). fin = fopen(filename, "r"); data/pacman4console-1.3/pacmanedit.c:389:12: [2] (misc) fopen: 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). fout = fopen(filename, "w"); data/pacman4console-1.3/debian/patches/pacman.c:61:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + int len = strlen(level); data/pacman4console-1.3/debian/patches/pacman.c:88:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). - if((argc > 1) && (strlen(argv[1]) > 1)) { data/pacman4console-1.3/debian/patches/pacman.c:105:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). - LevelFile[strlen(LevelFile) - 6] = '0'; data/pacman4console-1.3/debian/patches/pacman.c:106:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). - LevelFile[strlen(LevelFile) - 5] = LevelNumber + '0'; data/pacman4console-1.3/debian/patches/pacman.c:122:40: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + LevelFile[strlen(LevelFile) - 6] = '0'; data/pacman4console-1.3/debian/patches/pacman.c:123:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + LevelFile[strlen(LevelFile) - 5] = LevelNumber + '0'; data/pacman4console-1.3/debian/patches/pacman.c:152:18: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); data/pacman4console-1.3/debian/patches/pacman.c:242:6: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); //Pause, level complete data/pacman4console-1.3/pacman.c:91:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(level); data/pacman4console-1.3/pacman.c:128:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). LevelFile[strlen(LevelFile) - 6] = '0'; data/pacman4console-1.3/pacman.c:129:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). LevelFile[strlen(LevelFile) - 5] = LevelNumber + '0'; data/pacman4console-1.3/pacman.c:179:17: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); //and pause for a second data/pacman4console-1.3/pacman.c:195:17: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); data/pacman4console-1.3/pacman.c:216:17: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); //Pause for 1 second before continuing game data/pacman4console-1.3/pacman.c:501:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/pacman4console-1.3/pacman.c:508:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); data/pacman4console-1.3/pacman.c:520:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/pacman4console-1.3/pacman.c:523:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(150000); data/pacman4console-1.3/pacman.c:545:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/pacman4console-1.3/pacman.c:576:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = sizeof(error)-strlen(error)-1; data/pacman4console-1.3/pacman.c:577:13: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(error, levelfile, l); data/pacman4console-1.3/pacman.c:578:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(strlen(levelfile) > l) { data/pacman4console-1.3/pacman.c:621:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); //Pause for a second so they know they're about to play data/pacman4console-1.3/pacman.c:633:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); //Pause, level complete data/pacman4console-1.3/pacmanedit.c:58:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if((argc > 1) && (strlen(argv[1]) >= 1)) { ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 1494 in approximately 0.06 seconds (25744 lines/second) Physical Source Lines of Code (SLOC) = 913 Hits@level = [0] 21 [1] 25 [2] 13 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 62 [1+] 41 [2+] 16 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 67.908 [1+] 44.9069 [2+] 17.5246 [3+] 3.28587 [4+] 1.09529 [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.