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/infnoise-0.3.1+dfsg/software/Keccak/KeccakF-1600-interface.h Examining data/infnoise-0.3.1+dfsg/software/Keccak/KeccakF-1600-reference.c Examining data/infnoise-0.3.1+dfsg/software/Keccak/brg_endian.h Examining data/infnoise-0.3.1+dfsg/software/daemon.c Examining data/infnoise-0.3.1+dfsg/software/examples/libinfnoise/example-complex.c Examining data/infnoise-0.3.1+dfsg/software/examples/libinfnoise/example-simple.c Examining data/infnoise-0.3.1+dfsg/software/healthcheck.c Examining data/infnoise-0.3.1+dfsg/software/healthcheck.h Examining data/infnoise-0.3.1+dfsg/software/infnoise.c Examining data/infnoise-0.3.1+dfsg/software/infnoise.h Examining data/infnoise-0.3.1+dfsg/software/infnoise_win.c Examining data/infnoise-0.3.1+dfsg/software/libinfnoise.c Examining data/infnoise-0.3.1+dfsg/software/libinfnoise.h Examining data/infnoise-0.3.1+dfsg/software/libinfnoise_private.h Examining data/infnoise-0.3.1+dfsg/software/tools/bin2hex.c Examining data/infnoise-0.3.1+dfsg/software/tools/dice.c Examining data/infnoise-0.3.1+dfsg/software/tools/entcheck.c Examining data/infnoise-0.3.1+dfsg/software/tools/findlongest.c Examining data/infnoise-0.3.1+dfsg/software/tools/flipbits.c Examining data/infnoise-0.3.1+dfsg/software/tools/hex2bin.c Examining data/infnoise-0.3.1+dfsg/software/tools/passgen.c Examining data/infnoise-0.3.1+dfsg/software/writeentropy.c FINAL RESULTS: data/infnoise-0.3.1+dfsg/software/libinfnoise.c:223:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(*message, "ftdi_usb_get_strings failed: %d (%s)", rc, ftdi_get_error_string(&ftdic)); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:228:9: [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(current_entry->serial, serial); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:229:9: [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(current_entry->manufacturer, manufacturer); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:230:9: [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(current_entry->description, description); data/infnoise-0.3.1+dfsg/software/healthcheck.c:380:5: [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(NULL)); data/infnoise-0.3.1+dfsg/software/infnoise.c:104:18: [3] (buffer) getopt_long: 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_long(argc, argv, "rDRnm:p:s:dlvh", longopts, NULL)) != data/infnoise-0.3.1+dfsg/software/infnoise.c:186: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. if (getenv("INFNOISE_SERIAL") != NULL) { data/infnoise-0.3.1+dfsg/software/infnoise.c:187:27: [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. opts.serial = getenv("INFNOISE_SERIAL"); data/infnoise-0.3.1+dfsg/software/infnoise.c:192: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. if (getenv("INFNOISE_DEBUG") != NULL) { data/infnoise-0.3.1+dfsg/software/infnoise.c:193:33: [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 (!strcmp("true", getenv("INFNOISE_DEBUG"))) { data/infnoise-0.3.1+dfsg/software/infnoise.c:200: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. if (getenv("INFNOISE_MULTIPLIER") != NULL) { data/infnoise-0.3.1+dfsg/software/infnoise.c:201:38: [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. int tmpOutputMult = atoi(getenv("INFNOISE_MULTIPLIER")); data/infnoise-0.3.1+dfsg/software/tools/findlongest.c:14:5: [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(NULL)); data/infnoise-0.3.1+dfsg/software/Keccak/KeccakF-1600-reference.c:212: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(data, state, laneCount*8); data/infnoise-0.3.1+dfsg/software/daemon.c:15:15: [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). pidFile = fopen(fileName,"w"); data/infnoise-0.3.1+dfsg/software/infnoise.c:68:27: [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). devRandomFD = open("/dev/random", O_WRONLY); data/infnoise-0.3.1+dfsg/software/infnoise.c:121:37: [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). int tmpOutputMult = atoi(optarg); data/infnoise-0.3.1+dfsg/software/infnoise.c:201:33: [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). int tmpOutputMult = atoi(getenv("INFNOISE_MULTIPLIER")); data/infnoise-0.3.1+dfsg/software/infnoise.c:244:27: [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). int devRandomFD = open("/dev/random", O_WRONLY); data/infnoise-0.3.1+dfsg/software/infnoise_win.c:216:32: [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). outputMultiplier = atoi(argv[xArg]); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:132:13: [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(result, bytes, BUFLEN / 8u * sizeof(uint8_t)); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:158:13: [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(result, dataOut, *entropy / 8u * sizeof(uint8_t)); data/infnoise-0.3.1+dfsg/software/libinfnoise.c:201:5: [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 manufacturer[128], description[128], serial[128]; data/infnoise-0.3.1+dfsg/software/libinfnoise.h:30:5: [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 manufacturer[128]; data/infnoise-0.3.1+dfsg/software/libinfnoise.h:31:5: [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 description[129]; data/infnoise-0.3.1+dfsg/software/libinfnoise.h:32:5: [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 serial[128]; data/infnoise-0.3.1+dfsg/software/tools/dice.c:32:16: [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). FILE *file = fopen(argv[1], "r"); data/infnoise-0.3.1+dfsg/software/tools/dice.c:33:19: [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). uint32_t dice = atoi(argv[2]); data/infnoise-0.3.1+dfsg/software/tools/dice.c:34:20: [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). uint32_t sides = atoi(argv[3]); data/infnoise-0.3.1+dfsg/software/tools/entcheck.c:197:17: [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). N = atoi(argv[xArg]); data/infnoise-0.3.1+dfsg/software/tools/entcheck.c:206: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). numStreams = atoi(argv[xArg]); data/infnoise-0.3.1+dfsg/software/tools/findlongest.c:32:18: [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). FILE *file = fopen(fileName, "r"); data/infnoise-0.3.1+dfsg/software/tools/flipbits.c:54:17: [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). width = atoi(argv[1]); data/infnoise-0.3.1+dfsg/software/tools/passgen.c:33:16: [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). FILE *file = fopen(argv[1], "r"); data/infnoise-0.3.1+dfsg/software/tools/passgen.c:34:19: [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). uint32_t keys = atoi(argv[2]); data/infnoise-0.3.1+dfsg/software/writeentropy.c:24:18: [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). FILE *file = fopen(fileName, "r"); data/infnoise-0.3.1+dfsg/software/writeentropy.c:29:5: [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[42u]; data/infnoise-0.3.1+dfsg/software/writeentropy.c:37:22: [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). uint32_t value = atoi(buf); data/infnoise-0.3.1+dfsg/software/writeentropy.c:48:22: [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). inmDevRandomFD = open("/dev/random", O_RDWR); data/infnoise-0.3.1+dfsg/software/writeentropy.c:83: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(inmPoolInfo->buf, bytes, length); data/infnoise-0.3.1+dfsg/software/tools/bin2hex.c:4:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int value = getchar(); data/infnoise-0.3.1+dfsg/software/tools/bin2hex.c:8:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). value = getchar(); data/infnoise-0.3.1+dfsg/software/tools/dice.c:16:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(file); data/infnoise-0.3.1+dfsg/software/tools/dice.c:21:35: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). randVal = (randVal << 8u) | getc(file); data/infnoise-0.3.1+dfsg/software/tools/entcheck.c:218:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int value = getchar(); data/infnoise-0.3.1+dfsg/software/tools/entcheck.c:225:17: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). value = getchar(); data/infnoise-0.3.1+dfsg/software/tools/findlongest.c:40:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(file); data/infnoise-0.3.1+dfsg/software/tools/findlongest.c:55:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/infnoise-0.3.1+dfsg/software/tools/flipbits.c:19:21: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getchar(); data/infnoise-0.3.1+dfsg/software/tools/hex2bin.c:9:13: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getchar(); data/infnoise-0.3.1+dfsg/software/tools/hex2bin.c:11:13: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getchar(); data/infnoise-0.3.1+dfsg/software/tools/passgen.c:17:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(file); data/infnoise-0.3.1+dfsg/software/tools/passgen.c:22:35: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). randVal = (randVal << 8u) | getc(file); data/infnoise-0.3.1+dfsg/software/writeentropy.c:31:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(file); data/infnoise-0.3.1+dfsg/software/writeentropy.c:34:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 2766 in approximately 0.15 seconds (18316 lines/second) Physical Source Lines of Code (SLOC) = 2125 Hits@level = [0] 56 [1] 15 [2] 27 [3] 9 [4] 4 [5] 0 Hits@level+ = [0+] 111 [1+] 55 [2+] 40 [3+] 13 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 52.2353 [1+] 25.8824 [2+] 18.8235 [3+] 6.11765 [4+] 1.88235 [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.