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/nettoe-1.5.1/src/ai.c Examining data/nettoe-1.5.1/src/board.c Examining data/nettoe-1.5.1/src/board.h Examining data/nettoe-1.5.1/src/nettoe.c Examining data/nettoe-1.5.1/src/game.h Examining data/nettoe-1.5.1/src/matrices.c Examining data/nettoe-1.5.1/src/matrices.h Examining data/nettoe-1.5.1/src/terminal.c Examining data/nettoe-1.5.1/src/terminal.h Examining data/nettoe-1.5.1/src/misc.c Examining data/nettoe-1.5.1/src/misc.h Examining data/nettoe-1.5.1/src/network.c Examining data/nettoe-1.5.1/src/network.h Examining data/nettoe-1.5.1/test/terminfo.c FINAL RESULTS: data/nettoe-1.5.1/src/nettoe.c:175:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (SINGLE_DASHED_LINE); data/nettoe-1.5.1/src/nettoe.c:187:6: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (SINGLE_DASHED_LINE); data/nettoe-1.5.1/src/nettoe.c:189:6: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (BROKEN_DASHED_LINE); data/nettoe-1.5.1/src/nettoe.c:686:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (COMPUTER_CONSIDERS); data/nettoe-1.5.1/src/nettoe.c:696:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (COMPUTER_CONSIDERS); data/nettoe-1.5.1/src/nettoe.c:721:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (YOU_WIN); data/nettoe-1.5.1/src/nettoe.c:728:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (COMPUTER_WINS); data/nettoe-1.5.1/src/nettoe.c:735:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WANT_TO_PLAY); data/nettoe-1.5.1/src/nettoe.c:748:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (UNKNOWN_ANSWER); data/nettoe-1.5.1/src/nettoe.c:811:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WANT_TO_PLAY); data/nettoe-1.5.1/src/nettoe.c:822:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (UNKNOWN_ANSWER); data/nettoe-1.5.1/src/nettoe.c:857:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (SPACES_AND_BARS); data/nettoe-1.5.1/src/nettoe.c:859:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (BLOCKERS_AND_BARS); data/nettoe-1.5.1/src/nettoe.c:861:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (BLOCKERS_AND_BARS); data/nettoe-1.5.1/src/nettoe.c:863:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (SPACES_AND_BARS); data/nettoe-1.5.1/src/nettoe.c:867:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (BROKEN_DASHED_LINE); data/nettoe-1.5.1/src/nettoe.c:878:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (SINGLE_DASHED_LINE); data/nettoe-1.5.1/src/nettoe.c:885:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (IS_A_DRAW); data/nettoe-1.5.1/src/nettoe.c:1202:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (YOU_WIN); data/nettoe-1.5.1/src/nettoe.c:1221:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WANT_TO_PLAY); data/nettoe-1.5.1/src/nettoe.c:1237:4: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (UNKNOWN_ANSWER); data/nettoe-1.5.1/src/nettoe.c:1242:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WAITING_FOR_NAMED, player2_name); data/nettoe-1.5.1/src/nettoe.c:1328:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (YOU_WIN); data/nettoe-1.5.1/src/nettoe.c:1336:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WAITING_FOR_NAMED, player1_name); data/nettoe-1.5.1/src/nettoe.c:1351:7: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (WANT_TO_PLAY); data/nettoe-1.5.1/src/nettoe.c:1367:8: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf (UNKNOWN_ANSWER); data/nettoe-1.5.1/src/terminal.c:129:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system("clear 2>/dev/null")) data/nettoe-1.5.1/src/terminal.c:151:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(setaf_str, COLOR_DEFAULT); data/nettoe-1.5.1/src/terminal.c:154:12: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(setab_str, COLOR_DEFAULT); data/nettoe-1.5.1/src/terminal.c:210:9: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(setaf_str, fg); data/nettoe-1.5.1/src/board.c:96:8: [3] (random) random: 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. if ( random() % 2 ) { data/nettoe-1.5.1/src/board.c:102:8: [3] (random) random: 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. if ( random() % 2 ) { data/nettoe-1.5.1/src/board.c:108:8: [3] (random) random: 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. if ( random() % 2 ) { data/nettoe-1.5.1/src/misc.c:51:26: [3] (random) random: 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. generated_number = 1 + (random() % 10); data/nettoe-1.5.1/src/nettoe.c:125:3: [3] (random) srandom: 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. srandom(time(0)); data/nettoe-1.5.1/src/terminal.c:83:14: [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 ((sp = getenv("TERM")) == NULL) data/nettoe-1.5.1/test/terminfo.c:74:14: [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 ((sp = getenv("TERM")) == NULL) { data/nettoe-1.5.1/src/ai.c:43: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). char ** open; /* One field open for play. */ data/nettoe-1.5.1/src/board.c:45: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 * board[9]; data/nettoe-1.5.1/src/board.h:46: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 * board[9]; data/nettoe-1.5.1/src/misc.c:65: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 buffer[1024], *pek; data/nettoe-1.5.1/src/misc.c:106: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(str, "Anon"); data/nettoe-1.5.1/src/nettoe.c:60: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. static char player1_name[MAX_PNAME_LEN]; data/nettoe-1.5.1/src/nettoe.c:61: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. static char player2_name[MAX_PNAME_LEN]; data/nettoe-1.5.1/src/nettoe.c:197: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 answer[20]; data/nettoe-1.5.1/src/nettoe.c:357: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 answer[20]; data/nettoe-1.5.1/src/nettoe.c:478: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 answer[MAX_PNAME_LEN]; data/nettoe-1.5.1/src/nettoe.c:672: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 y_n[12]; data/nettoe-1.5.1/src/nettoe.c:757: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 y_n[12]; data/nettoe-1.5.1/src/nettoe.c:901: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 move[4]; data/nettoe-1.5.1/src/nettoe.c:935: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 local_ip_address[INET6_ADDRSTRLEN]; data/nettoe-1.5.1/src/nettoe.c:936: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 peer_ip_address[INET6_ADDRSTRLEN]; data/nettoe-1.5.1/src/nettoe.c:1033: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[MAXDATASIZE]; data/nettoe-1.5.1/src/nettoe.c:1034: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 host_ip_number[INET6_ADDRSTRLEN + 1]; data/nettoe-1.5.1/src/nettoe.c:1119: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[MAXDATASIZE]; data/nettoe-1.5.1/src/nettoe.c:1149: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 y_n[12]; data/nettoe-1.5.1/src/nettoe.c:1150: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 yes_no[2]; data/nettoe-1.5.1/src/nettoe.c:1151: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[MAXDATASIZE]; data/nettoe-1.5.1/src/nettoe.c:1264: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 y_n[12]; data/nettoe-1.5.1/src/nettoe.c:1265: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 yes_no[2]; data/nettoe-1.5.1/src/nettoe.c:1266: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[MAXDATASIZE]; data/nettoe-1.5.1/src/network.c:55: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 portstr[10]; data/nettoe-1.5.1/src/network.c:66:2: [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(portstr, "%u", port_number); data/nettoe-1.5.1/src/network.c:158: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 portstr[20]; data/nettoe-1.5.1/src/network.c:170:2: [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(portstr, "%u", port_number); data/nettoe-1.5.1/src/network.c:269: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 hostname[100]; data/nettoe-1.5.1/src/terminal.c:80:11: [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 buf[1024]; data/nettoe-1.5.1/src/terminal.c:186: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 cmd_str[13]; data/nettoe-1.5.1/src/terminal.c:194:9: [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(cmd_str, "%c[%d;%dm", 0x1B, attrib, fg + 30); data/nettoe-1.5.1/src/terminal.c:199:9: [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(cmd_str, "%c[%dm", 0x1B, attrib); data/nettoe-1.5.1/test/terminfo.c:70:11: [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 buf[1024]; data/nettoe-1.5.1/src/board.c:193:42: [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 (!strncasecmp (move, p->string, strlen (p->string))) data/nettoe-1.5.1/src/board.c:195:38: [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 (!strncmp (move, p->string, strlen (p->string))) data/nettoe-1.5.1/src/misc.c:116:8: [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(pname)) > maxlen ) data/nettoe-1.5.1/src/misc.c:152:2: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar (); data/nettoe-1.5.1/src/nettoe.c:584:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:736:7: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf ("%11s", y_n) != 1) data/nettoe-1.5.1/src/nettoe.c:738:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:812:7: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf ("%11s", y_n) != 1) data/nettoe-1.5.1/src/nettoe.c:814:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:912:11: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf ("%3s", move) != 1) data/nettoe-1.5.1/src/nettoe.c:976:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:1050:7: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf (" %46s", host_ip_number) != 1) data/nettoe-1.5.1/src/nettoe.c:1061:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:1222:7: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf ("%11s", y_n) != 1) data/nettoe-1.5.1/src/nettoe.c:1224:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/nettoe.c:1352:11: [1] (buffer) scanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (scanf ("%11s", y_n) != 1) data/nettoe-1.5.1/src/nettoe.c:1354:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/nettoe-1.5.1/src/network.c:218:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( (bytesread = read(connected_socket, buffer, bytes-bytescount)) ANALYSIS SUMMARY: Hits = 89 Lines analyzed = 3142 in approximately 0.11 seconds (28942 lines/second) Physical Source Lines of Code (SLOC) = 2254 Hits@level = [0] 260 [1] 18 [2] 34 [3] 7 [4] 30 [5] 0 Hits@level+ = [0+] 349 [1+] 89 [2+] 71 [3+] 37 [4+] 30 [5+] 0 Hits/KSLOC@level+ = [0+] 154.836 [1+] 39.4854 [2+] 31.4996 [3+] 16.4153 [4+] 13.3097 [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.