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/gemdropx-0.9/cqml/cqml.h Examining data/gemdropx-0.9/cqml/mainwin.cpp Examining data/gemdropx-0.9/cqml/cqml.cpp Examining data/gemdropx-0.9/cqml/mainwin.h Examining data/gemdropx-0.9/gemdropx.c FINAL RESULTS: data/gemdropx-0.9/gemdropx.c:644:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s/images/%s.bmp", DATA_PREFIX, object_filenames[i]); data/gemdropx-0.9/gemdropx.c:753:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s/sounds/%s.wav", DATA_PREFIX, sound_filenames[i]); data/gemdropx-0.9/gemdropx.c:770:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s/sounds/%s", DATA_PREFIX, music_filenames[i]); data/gemdropx-0.9/gemdropx.c:719:3: [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(SDL_GetTicks()); data/gemdropx-0.9/gemdropx.c:2669:8: [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. if ( getenv("HOME" ) != NULL ) data/gemdropx-0.9/gemdropx.c:2672:61: [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. snprintf(datafile,sizeof(datafile)-1, "%s/.gemdropx", getenv("HOME")); data/gemdropx-0.9/gemdropx.c:126: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 * object_filenames[NUM_OBJECTS] = {"block", "yellowgem", data/gemdropx-0.9/gemdropx.c:160: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 * sound_filenames[NUM_SOUNDS] = { data/gemdropx-0.9/gemdropx.c:175: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 * music_filenames[NUM_MODS] = { data/gemdropx-0.9/gemdropx.c:503: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 file[128]; data/gemdropx-0.9/gemdropx.c:790: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 temp[11]; data/gemdropx-0.9/gemdropx.c:794:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(temp, "%-10u", num); data/gemdropx-0.9/gemdropx.c:2562: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 datafile[1024]; data/gemdropx-0.9/gemdropx.c:2675:8: [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). fi = fopen(datafile, "r"); data/gemdropx-0.9/gemdropx.c:2718:8: [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). fi = fopen(datafile, "w"); data/gemdropx-0.9/gemdropx.c:407:3: [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(ms * 1000); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 3090 in approximately 0.08 seconds (39502 lines/second) Physical Source Lines of Code (SLOC) = 1970 Hits@level = [0] 60 [1] 1 [2] 9 [3] 3 [4] 3 [5] 0 Hits@level+ = [0+] 76 [1+] 16 [2+] 15 [3+] 6 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 38.5787 [1+] 8.12183 [2+] 7.61421 [3+] 3.04569 [4+] 1.52284 [5+] 0 Dot directories skipped = 2 (--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.