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/atom4-4.1/atom4.cc Examining data/atom4-4.1/interface.h Examining data/atom4-4.1/interface.cc Examining data/atom4-4.1/ncurses/textui.cc Examining data/atom4-4.1/ncurses/textui.h Examining data/atom4-4.1/x/xatom4.cc Examining data/atom4-4.1/x/xatom4.h Examining data/atom4-4.1/x/xtext.h Examining data/atom4-4.1/x/xcursor.cc Examining data/atom4-4.1/x/xgraphics.h Examining data/atom4-4.1/x/context.h Examining data/atom4-4.1/x/xutil.cc Examining data/atom4-4.1/x/xutil.h Examining data/atom4-4.1/x/xscoreboard.cc Examining data/atom4-4.1/x/xsprite.cc Examining data/atom4-4.1/x/xsprite.h Examining data/atom4-4.1/x/xtriboard.cc Examining data/atom4-4.1/x/xtriboard.h Examining data/atom4-4.1/x/xscoreboard.h Examining data/atom4-4.1/x/xcursor.h Examining data/atom4-4.1/engine/triboard.cc Examining data/atom4-4.1/engine/triboard.h Examining data/atom4-4.1/engine/game.cc Examining data/atom4-4.1/engine/game.h Examining data/atom4-4.1/engine/ai.h Examining data/atom4-4.1/engine/ai.cc Examining data/atom4-4.1/engine/color4.h Examining data/atom4-4.1/engine/board4.h Examining data/atom4-4.1/engine/color4.cc Examining data/atom4-4.1/engine/board4.cc Examining data/atom4-4.1/engine/gametree.h Examining data/atom4-4.1/general/resource.cc Examining data/atom4-4.1/general/resource.h Examining data/atom4-4.1/general/event.cc Examining data/atom4-4.1/general/event.h Examining data/atom4-4.1/general/testtimer.cc Examining data/atom4-4.1/net/net.cc Examining data/atom4-4.1/net/net.h Examining data/atom4-4.1/net/server.cc Examining data/atom4-4.1/net/server.h Examining data/atom4-4.1/net/testserv.cc Examining data/atom4-4.1/proglib/c/error.h Examining data/atom4-4.1/proglib/c++/list.h Examining data/atom4-4.1/proglib/c++/dlist.h Examining data/atom4-4.1/proglib/c++/stack.h Examining data/atom4-4.1/proglib/c++/dlist.cc Examining data/atom4-4.1/proglib/c++/list.cc Examining data/atom4-4.1/proglib/c++/stack.cc Examining data/atom4-4.1/proglib/c++/txtutil.h Examining data/atom4-4.1/proglib/c++/txtutil.cc Examining data/atom4-4.1/proglib/c++/exception.cc Examining data/atom4-4.1/proglib/c++/exception.h FINAL RESULTS: data/atom4-4.1/ncurses/textui.cc:111:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. rc=vsnprintf(strbuf, STRBUF_SIZE, fmt, args); data/atom4-4.1/ncurses/textui.cc:122:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. rc=vsnprintf(strbuf, STRBUF_SIZE, fmt, args); data/atom4-4.1/net/net.cc:192:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. count=vsnprintf(sendbuf, NET_LINE_LIMIT, fmt, args); data/atom4-4.1/net/server.cc:424: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(hostname, hostinfo->h_name); data/atom4-4.1/net/server.cc:429: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(hostname, ipadrs); data/atom4-4.1/proglib/c++/exception.cc:29:10: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. msglen=vsnprintf(msg, bufsize, fmt, args); data/atom4-4.1/proglib/c++/exception.cc:41:5: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(msg, bufsize, fmt, args); data/atom4-4.1/proglib/c++/exception.cc:61: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(msg, e.msg); data/atom4-4.1/atom4.cc:30: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((unsigned int)time(NULL)); data/atom4-4.1/atom4.cc:66:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch=getopt(argc, argv, "a:cd:hm:")) != -1) { data/atom4-4.1/atom4.cc:96:22: [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. char *xdisplay = getenv("DISPLAY"); data/atom4-4.1/atom4.cc:77:26: [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). case 'd': ai_level = atoi(optarg); break; data/atom4-4.1/engine/ai.cc:34: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). logfile=fopen("/tmp/atom4ai.log","w"); data/atom4-4.1/engine/ai.cc:284: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). logfile=fopen("/tmp/atom4ai.log","w"); data/atom4-4.1/ncurses/textui.h:71: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 cellbold[NUM_CELLTYPES]; // color pairs which must be bolded data/atom4-4.1/ncurses/textui.h:85: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 strbuf[STRBUF_SIZE]; // temp buffer for formatting strings data/atom4-4.1/net/net.h:70: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 rcvbuf[NET_BUFFER_SIZE]; // network buffer (circular buffer) data/atom4-4.1/net/server.cc:38: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 cell2net[NUM_COLORS] = { data/atom4-4.1/x/xscoreboard.cc:42: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 *wheelnames[NUM_WHEELS] = { data/atom4-4.1/x/xscoreboard.cc:125: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 buf[TEXTBUF_MAX+1]; data/atom4-4.1/x/xtriboard.h:35:16: [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 *ballnames[NUM_BALLS]; data/atom4-4.1/engine/ai.cc:51:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &x, sizeof(x))==-1) data/atom4-4.1/engine/ai.cc:53:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &y, sizeof(y))==-1) data/atom4-4.1/net/net.cc:255:11: [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). count = strlen(packet); data/atom4-4.1/net/server.cc:171:7: [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(cp) > 0) { data/atom4-4.1/net/server.cc:423:25: [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). hostname = new char[strlen(hostinfo->h_name)+1]; data/atom4-4.1/net/server.cc:428:25: [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). hostname = new char[strlen(ipadrs)+1]; data/atom4-4.1/net/server.cc:444:25: [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). send(csock, errormsg, strlen(errormsg)+1, MSG_NOSIGNAL); data/atom4-4.1/proglib/c++/exception.cc:26:15: [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). bufsize = 3*strlen(fmt)/2; // guesstimate of required length data/atom4-4.1/proglib/c++/exception.cc:59:20: [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). msg = new char[strlen(e.msg)+1]; data/atom4-4.1/x/xscoreboard.cc:114:17: [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 textlen = strlen(text); data/atom4-4.1/x/xscoreboard.cc:129:20: [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). buf, strlen(buf)); data/atom4-4.1/x/xscoreboard.cc:133:20: [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). buf, strlen(buf)); data/atom4-4.1/x/xscoreboard.cc:142:22: [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). buf, strlen(buf)); data/atom4-4.1/x/xscoreboard.cc:146:22: [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). buf, strlen(buf)); data/atom4-4.1/x/xscoreboard.cc:150:22: [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). buf, strlen(buf)); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 7079 in approximately 0.20 seconds (34563 lines/second) Physical Source Lines of Code (SLOC) = 4451 Hits@level = [0] 36 [1] 15 [2] 10 [3] 3 [4] 8 [5] 0 Hits@level+ = [0+] 72 [1+] 36 [2+] 21 [3+] 11 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 16.1761 [1+] 8.08807 [2+] 4.71804 [3+] 2.47135 [4+] 1.79735 [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.