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/twofish-0.3/main.c Examining data/twofish-0.3/debian/local/catwo.c Examining data/twofish-0.3/debian/local/simple-internal-test.c Examining data/twofish-0.3/twofish.c Examining data/twofish-0.3/twofish.h FINAL RESULTS: data/twofish-0.3/debian/local/simple-internal-test.c:74: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(time(NULL)); data/twofish-0.3/debian/local/simple-internal-test.c:94:11: [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. seed = random(); data/twofish-0.3/debian/local/catwo.c:65: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. strncpy((char *) key, argv[1 + shift], sizeof(key)); data/twofish-0.3/debian/local/simple-internal-test.c:20:13: [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. void to_hex(char hex[2], int ch) { data/twofish-0.3/debian/local/simple-internal-test.c:38: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 hex[2]; data/twofish-0.3/debian/local/simple-internal-test.c:66: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). rounds = atoi(argv[j]); data/twofish-0.3/debian/local/simple-internal-test.c:87: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(key, FIXEDKEYSTR, sizeof(FIXEDKEYSTR)); data/twofish-0.3/debian/local/simple-internal-test.c:95: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(key + j * sizeof(seed), &seed, sizeof(seed)); data/twofish-0.3/twofish.c:1373:5: [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( K, key, key_len ); data/twofish-0.3/twofish.c:1475:9: [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( sptr+4, kptr, 8 ); data/twofish-0.3/debian/local/catwo.c:53: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). keylen = strlen(argv[1 + shift]); data/twofish-0.3/debian/local/catwo.c:65:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *) key, argv[1 + shift], sizeof(key)); data/twofish-0.3/debian/local/catwo.c:71:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(STDIN_FILENO, inblock, sizeof(inblock)) > 0) { ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 2126 in approximately 0.13 seconds (16684 lines/second) Physical Source Lines of Code (SLOC) = 668 Hits@level = [0] 8 [1] 3 [2] 8 [3] 2 [4] 0 [5] 0 Hits@level+ = [0+] 21 [1+] 13 [2+] 10 [3+] 2 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 31.4371 [1+] 19.4611 [2+] 14.9701 [3+] 2.99401 [4+] 0 [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.