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/termtris-1.3/src/ansi.c
Examining data/termtris-1.3/src/ansi.h
Examining data/termtris-1.3/src/game.c
Examining data/termtris-1.3/src/game.h
Examining data/termtris-1.3/src/main.c
Examining data/termtris-1.3/src/pieces.h
Examining data/termtris-1.3/src/scoredb.c
Examining data/termtris-1.3/src/scoredb.h

FINAL RESULTS:

data/termtris-1.3/src/scoredb.c:153:3:  [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(node->user, ent.user);
data/termtris-1.3/src/game.c:176: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(time(0));
data/termtris-1.3/src/ansi.c:103: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 cmd[32];
data/termtris-1.3/src/ansi.c:108:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy(ptr, "\033(0", 3);
data/termtris-1.3/src/ansi.c:116:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy(ptr, "\033(B", 3);
data/termtris-1.3/src/ansi.c:126:10:  [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.
		ptr += sprintf(ptr, "\033[;%d;%dm", fg + 30, bg + 40);
data/termtris-1.3/src/game.c:142:14:  [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.
static const char *bgdata[SCR_ROWS] = {
data/termtris-1.3/src/game.c:340:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
		memcpy(pos, next_pos, sizeof pos);
data/termtris-1.3/src/game.c:409:9:  [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.
	static char escbuf[64];
data/termtris-1.3/src/game.c:673:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy(dptr, sptr, PF_COLS * sizeof *dptr);
data/termtris-1.3/src/main.c:72: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.
	static unsigned char buf[128];
data/termtris-1.3/src/main.c:146: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).
	if((jsdev = open(jsdevfile ? jsdevfile : def_jsdevfile, O_RDONLY | O_NONBLOCK)) == -1 && jsdevfile) {
data/termtris-1.3/src/main.c:153:11:  [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).
	if((fd = open(termfile, O_RDWR)) == -1) {
data/termtris-1.3/src/main.c:182:2:  [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).
	open("/tmp/termtris.log", O_WRONLY | O_CREAT | O_TRUNC, 0664);
data/termtris-1.3/src/main.c:190: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 name[256];
data/termtris-1.3/src/pieces.h:27: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.
static unsigned char pieces[NUM_PIECES][4][4] = {
data/termtris-1.3/src/scoredb.c:58:11:  [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).
	if((fd = open(SCOREDB_PATH, O_RDWR | O_CREAT, 0666)) == -1 || !(fp = fdopen(fd, "r+"))) {
data/termtris-1.3/src/scoredb.c:138: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 buf[128];
data/termtris-1.3/src/scoredb.c:185: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 buf[128];
data/termtris-1.3/src/scoredb.c:188: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).
	if(!(fp = fopen(SCOREDB_PATH, "r"))) {
data/termtris-1.3/src/main.c:109:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				int rd = read(0, buf, sizeof buf);
data/termtris-1.3/src/main.c:181:2:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	umask(002);
data/termtris-1.3/src/main.c:330:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while(read(jsdev, &ev, sizeof ev) > 0) {
data/termtris-1.3/src/scoredb.c:147:62:  [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(!(node = malloc(sizeof *node)) || !(node->user = malloc(strlen(ent.user) + 1))) {

ANALYSIS SUMMARY:

Hits = 24
Lines analyzed = 1687 in approximately 0.05 seconds (34221 lines/second)
Physical Source Lines of Code (SLOC) = 1282
Hits@level = [0]  40 [1]   4 [2]  18 [3]   1 [4]   1 [5]   0
Hits@level+ = [0+]  64 [1+]  24 [2+]  20 [3+]   2 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 49.922 [1+] 18.7207 [2+] 15.6006 [3+] 1.56006 [4+] 0.780031 [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.