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/garden-of-coloured-lights-1.0.9/src/cloud.c Examining data/garden-of-coloured-lights-1.0.9/src/display.c Examining data/garden-of-coloured-lights-1.0.9/src/palette.h Examining data/garden-of-coloured-lights-1.0.9/src/display_init.c Examining data/garden-of-coloured-lights-1.0.9/src/level.h Examining data/garden-of-coloured-lights-1.0.9/src/menu.h Examining data/garden-of-coloured-lights-1.0.9/src/level.c Examining data/garden-of-coloured-lights-1.0.9/src/system.h Examining data/garden-of-coloured-lights-1.0.9/src/display_init.h Examining data/garden-of-coloured-lights-1.0.9/src/game.h Examining data/garden-of-coloured-lights-1.0.9/src/ebullet.h Examining data/garden-of-coloured-lights-1.0.9/src/config.h Examining data/garden-of-coloured-lights-1.0.9/src/eclass.c Examining data/garden-of-coloured-lights-1.0.9/src/menu.c Examining data/garden-of-coloured-lights-1.0.9/src/sound.c Examining data/garden-of-coloured-lights-1.0.9/src/globvars.h Examining data/garden-of-coloured-lights-1.0.9/src/stuff.h Examining data/garden-of-coloured-lights-1.0.9/src/sound.h Examining data/garden-of-coloured-lights-1.0.9/src/cloud.h Examining data/garden-of-coloured-lights-1.0.9/src/input.c Examining data/garden-of-coloured-lights-1.0.9/src/enemy.c Examining data/garden-of-coloured-lights-1.0.9/src/display.h Examining data/garden-of-coloured-lights-1.0.9/src/ebullet.c Examining data/garden-of-coloured-lights-1.0.9/src/stuff.c Examining data/garden-of-coloured-lights-1.0.9/src/pbullet.h Examining data/garden-of-coloured-lights-1.0.9/src/enemy.h Examining data/garden-of-coloured-lights-1.0.9/src/pbullet.c Examining data/garden-of-coloured-lights-1.0.9/src/game.c Examining data/garden-of-coloured-lights-1.0.9/src/palette.c Examining data/garden-of-coloured-lights-1.0.9/src/input.h Examining data/garden-of-coloured-lights-1.0.9/src/main.c FINAL RESULTS: data/garden-of-coloured-lights-1.0.9/src/main.c:155:2: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(filename_buffer, "init.txt", sizeof(filename_buffer)); data/garden-of-coloured-lights-1.0.9/src/main.c:166:3: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(right_path, "/.garden", sizeof(right_path) ); data/garden-of-coloured-lights-1.0.9/src/main.c:172:3: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(right_path, "/init.txt", sizeof(right_path) ); data/garden-of-coloured-lights-1.0.9/src/input.c:97:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (sfile, "%s%02d", sfile, scrs); data/garden-of-coloured-lights-1.0.9/src/main.c:156:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(filename_buffer, W_OK) == 0) data/garden-of-coloured-lights-1.0.9/src/main.c:167:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(right_path, R_OK) != 0 ) /* we have to mkdir */ data/garden-of-coloured-lights-1.0.9/src/main.c:173:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(right_path, R_OK) != 0 ) data/garden-of-coloured-lights-1.0.9/src/main.c:163:28: [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. const char * unix_path = getenv("HOME"); data/garden-of-coloured-lights-1.0.9/src/main.c:164:29: [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. const char * vista_path = getenv("APPDATA"); data/garden-of-coloured-lights-1.0.9/src/main.c:213: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(randseed); data/garden-of-coloured-lights-1.0.9/src/config.h:30: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 data_directory[DATADIR_SIZE]; data/garden-of-coloured-lights-1.0.9/src/config.h:203: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 beam_flicker[3]; data/garden-of-coloured-lights-1.0.9/src/display_init.c:124: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_buffer [DATADIR_SIZE]; data/garden-of-coloured-lights-1.0.9/src/input.c:84: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 sfile[64]; data/garden-of-coloured-lights-1.0.9/src/input.c:85: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 istr[64]; data/garden-of-coloured-lights-1.0.9/src/input.c:96: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 (sfile, "screenshot_"); data/garden-of-coloured-lights-1.0.9/src/input.c:99:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat (sfile, ".bmp"); data/garden-of-coloured-lights-1.0.9/src/main.c:64: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 data_directory[DATADIR_SIZE] = "\0"; data/garden-of-coloured-lights-1.0.9/src/main.c:153: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 filename_buffer [DATADIR_SIZE]; data/garden-of-coloured-lights-1.0.9/src/main.c:162:3: [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 right_path[512]; data/garden-of-coloured-lights-1.0.9/src/main.c:175:4: [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 buffer[128]; data/garden-of-coloured-lights-1.0.9/src/main.c:177:29: [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). FILE * unwritable_file = fopen(filename_buffer, "r"); data/garden-of-coloured-lights-1.0.9/src/main.c:178:23: [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). FILE * init_file = fopen(right_path, "w"); data/garden-of-coloured-lights-1.0.9/src/sound.c:1606: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 filename_buffer[DATADIR_SIZE]; data/garden-of-coloured-lights-1.0.9/src/display_init.c:163:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:164:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/garden.dat", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:186:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:187:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/splash.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:361:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:362:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/small.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:525:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:526:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/large.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:539:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:540:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/large.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:626:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:627:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/trans.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:973:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:974:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/multi.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:1073:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/display_init.c:1074:2: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "gfx/platform.bmp", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/main.c:104:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data_directory, DATADIR, sizeof(data_directory)); data/garden-of-coloured-lights-1.0.9/src/main.c:105:2: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(data_directory, "/"); data/garden-of-coloured-lights-1.0.9/src/main.c:154:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(filename_buffer)); data/garden-of-coloured-lights-1.0.9/src/main.c:165:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(right_path, (unix_path != NULL ? unix_path : vista_path), sizeof(right_path) ); data/garden-of-coloured-lights-1.0.9/src/sound.c:1608:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename_buffer, data_directory, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/sound.c:1611:3: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "wavs/", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/sound.c:1614:3: [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. Risk is low because the source is a constant string. strncat(filename_buffer, "beat/", sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/sound.c:1616:2: [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 (filename_buffer, sfile, sizeof(char) * DATADIR_SIZE); data/garden-of-coloured-lights-1.0.9/src/sound.c:1617:2: [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. Risk is low because the source is a constant string. strncat (filename_buffer, ".wav", sizeof(char) * DATADIR_SIZE); ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 27864 in approximately 0.66 seconds (41992 lines/second) Physical Source Lines of Code (SLOC) = 20383 Hits@level = [0] 1 [1] 25 [2] 14 [3] 3 [4] 4 [5] 3 Hits@level+ = [0+] 50 [1+] 49 [2+] 24 [3+] 10 [4+] 7 [5+] 3 Hits/KSLOC@level+ = [0+] 2.45302 [1+] 2.40396 [2+] 1.17745 [3+] 0.490605 [4+] 0.343423 [5+] 0.147181 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.