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/robotfindskitten-2.8284271.702/src/robotfindskitten.c FINAL RESULTS: data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:167:10: [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). (void) strcpy ( buff, msg ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:245:11: [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). (void) strcpy ( fname, dname ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:247:11: [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). (void) strcpy ( ( fname + plen + 1 ), dent->d_name ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:296:10: [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). (void) strcpy ( user_nki_dir, home_dir ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:298:10: [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). (void) strcpy ( user_nki_dir + home_len + 1, USER_NKI_DIR ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:287:13: [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. home_dir = getenv ( "HOME" ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:312:24: [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. /*@i1@*/j = i + ( random() % ( state.num_messages - i ) ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:323:29: [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. #define randx() ( FRAME + ( random() % ( state.cols - FRAME * 2 ) ) ) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:324:39: [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. #define randy() ( HEADSIZE + FRAME + (random() % ( state.lines - HEADSIZE - FRAME * 2 ) ) ) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:325:20: [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. #define randch() ( random() % ( '~' - '!' + 1 ) + '!' ) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:326:24: [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. #define randbold() ( ( random() % 2 ) ? true : false ) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:327:23: [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. #define randcolor() ( random() % 6 + 1 ) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:328:31: [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. #define randint(m, n) ((m) + (random() % ((n) + 1))) data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:738:19: [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 ((option = getopt(argc, argv, "n:s:f:Vh")) != -1) { data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:766:2: [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 ( seed ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:157:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy ( nmess, state.messages, data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:183: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 ( ( fd = open ( fname, O_RDONLY ) ) != -1 ) { data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:192:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy ( buff2, buff, alloc ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:579:2: [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(&kitten, &state.items[KITTEN], sizeof kitten); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:580:2: [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(&robot, &state.items[ROBOT], sizeof robot); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:744:12: [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). nbogus = atoi ( optarg ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:751:10: [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). seed = atoi(optarg); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:185:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t ret = read ( fd, &ch, 1 ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:237:9: [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). plen = strlen ( dname ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:240:16: [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). len = plen + strlen ( dent->d_name ) + 2; data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:250:34: [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). ext = malloc(sizeof(char) * strlen(fname) + 1); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:255:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(ext, fname+(strlen(fname) - 3), strlen(fname)); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:255:33: [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). (void) strncpy(ext, fname+(strlen(fname) - 3), strlen(fname)); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:255:53: [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). (void) strncpy(ext, fname+(strlen(fname) - 3), strlen(fname)); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:289:21: [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). size_t home_len = strlen ( home_dir ); data/robotfindskitten-2.8284271.702/src/robotfindskitten.c:290:40: [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). size_t user_nki_len = home_len + 1 + strlen ( USER_NKI_DIR ) + 1; ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 791 in approximately 0.03 seconds (25464 lines/second) Physical Source Lines of Code (SLOC) = 633 Hits@level = [0] 11 [1] 9 [2] 7 [3] 10 [4] 5 [5] 0 Hits@level+ = [0+] 42 [1+] 31 [2+] 22 [3+] 15 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 66.3507 [1+] 48.9731 [2+] 34.7551 [3+] 23.6967 [4+] 7.89889 [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.