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/jitterentropy-rngd-1.1.0/jitterentropy-base.c Examining data/jitterentropy-rngd-1.1.0/jitterentropy-base-user.h Examining data/jitterentropy-rngd-1.1.0/jitterentropy.h Examining data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c FINAL RESULTS: data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:201:3: [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, sizeof(msg), fmt, args); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:149:7: [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. c = getopt_long(argc, argv, "vp:h", opts, &opt_index); data/jitterentropy-rngd-1.1.0/jitterentropy-base-user.h:172: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 buf[2] = "0"; data/jitterentropy-rngd-1.1.0/jitterentropy-base-user.h:175:12: [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(FIPS_MODE_SWITCH_FILE, O_RDONLY)) >= 0) { data/jitterentropy-rngd-1.1.0/jitterentropy-base.c:587: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(p, &ec->data, tocopy); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:118: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 version[30]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:138: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 version[30]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:196: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 msg[1024]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:197: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 sev[10]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:248: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(rng->rpi->buf, buf, len); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:270: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 buf[(ENTROPYBYTES * OVERSAMPLINGFACTOR)]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:299: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 buf[5]; data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:314: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). entropy = atoi(buf); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:444:12: [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). rng->fd = open(rng->dev, O_WRONLY); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:460:21: [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). Entropy_avail_fd = open(ENTROPYAVAIL, O_RDONLY); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:507: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 pid_str[12]; /* max. integer length + '\n' + null */ data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:510:15: [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). Pidfile_fd = open(pid_file, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); data/jitterentropy-rngd-1.1.0/jitterentropy-base-user.h:176:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(fd, buf, sizeof(buf)) < 0 && errno == EINTR); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:302:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). data = read(fd, buf, sizeof(buf)); data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:529: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). if (write(Pidfile_fd, pid_str, strlen(pid_str)) != data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:530: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). (ssize_t)strlen(pid_str)) { data/jitterentropy-rngd-1.1.0/jitterentropy-rngd.c:565: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). if (Pidfile && strlen(Pidfile)) ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 1783 in approximately 0.08 seconds (21334 lines/second) Physical Source Lines of Code (SLOC) = 919 Hits@level = [0] 19 [1] 5 [2] 15 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 41 [1+] 22 [2+] 17 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 44.6137 [1+] 23.9391 [2+] 18.4984 [3+] 2.17628 [4+] 1.08814 [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.