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/fnotifystat-0.02.07/fnotifystat.c

FINAL RESULTS:

data/fnotifystat-0.02.07/fnotifystat.c:909:8:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	len = readlink(buf, path, sizeof(path));
data/fnotifystat-0.02.07/fnotifystat.c:1406:11:  [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.
		int c = getopt(argc, argv, "hvdt:p:PcTsi:x:nmMDIf");
data/fnotifystat-0.02.07/fnotifystat.c:67: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).
	uint64_t	open;			/* Count of opens */
data/fnotifystat-0.02.07/fnotifystat.c:256: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];
data/fnotifystat-0.02.07/fnotifystat.c:258:7:  [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).
	fp = fopen("/proc/mounts", "r");
data/fnotifystat-0.02.07/fnotifystat.c:301: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 path[PATH_MAX];
data/fnotifystat-0.02.07/fnotifystat.c:354:9:  [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 buffer[256];
data/fnotifystat-0.02.07/fnotifystat.c:355: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 devstr[32];
data/fnotifystat-0.02.07/fnotifystat.c:375: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[32];
data/fnotifystat-0.02.07/fnotifystat.c:381:7:  [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).
	fd = open("/proc/sys/kernel/pid_max", O_RDONLY);
data/fnotifystat-0.02.07/fnotifystat.c:567: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[BUFFER_SIZE];
data/fnotifystat-0.02.07/fnotifystat.c:573: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(buffer, O_RDONLY)) > -1) {
data/fnotifystat-0.02.07/fnotifystat.c:585:13:  [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(buffer, O_RDONLY)) > -1) {
data/fnotifystat-0.02.07/fnotifystat.c:713:16:  [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).
			pid_t pid = atoi(dirp->d_name);
data/fnotifystat-0.02.07/fnotifystat.c:894: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[256];
data/fnotifystat-0.02.07/fnotifystat.c:895: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 	path[PATH_MAX];
data/fnotifystat-0.02.07/fnotifystat.c:955:9:  [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 modes[5];
data/fnotifystat-0.02.07/fnotifystat.c:985:23:  [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).
		info->fs.open = fs->open;
data/fnotifystat-0.02.07/fnotifystat.c:1021: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 str[64];
data/fnotifystat-0.02.07/fnotifystat.c:1042:31:  [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).
	    (fs->open == previous.fs.open) &&
data/fnotifystat-0.02.07/fnotifystat.c:1196: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 ts[32];
data/fnotifystat-0.02.07/fnotifystat.c:1237: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 buf[5][32];
data/fnotifystat-0.02.07/fnotifystat.c:1241:29:  [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).
				count_to_str(sorted[j]->open / dur, buf[1], sizeof(buf[1])),
data/fnotifystat-0.02.07/fnotifystat.c:69:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	uint64_t	read;			/* Count of reads */
data/fnotifystat-0.02.07/fnotifystat.c:384:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	n = read(fd, buf, sizeof(buf) - 1);
data/fnotifystat-0.02.07/fnotifystat.c:418: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).
	*len = strlen(str);
data/fnotifystat-0.02.07/fnotifystat.c:443: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).
	size_t len = strlen(str);
data/fnotifystat-0.02.07/fnotifystat.c:574:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ret = read(fd, buffer, sizeof(buffer) - 1);
data/fnotifystat-0.02.07/fnotifystat.c:586:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ret = read(fd, buffer, sizeof(buffer) - 1);
data/fnotifystat-0.02.07/fnotifystat.c:594:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
		(void)strncpy(buffer, "<unknown>", sizeof(buffer));
data/fnotifystat-0.02.07/fnotifystat.c:987:23:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		info->fs.read = fs->read;
data/fnotifystat-0.02.07/fnotifystat.c:1044:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	    (fs->read == previous.fs.read) &&
data/fnotifystat-0.02.07/fnotifystat.c:1243:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				count_to_str(sorted[j]->read/ dur, buf[3], sizeof(buf[3])),
data/fnotifystat-0.02.07/fnotifystat.c:1336: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).
		p->pathlen = strlen(p->pathname);
data/fnotifystat-0.02.07/fnotifystat.c:1578:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if ((len = read(fan_fd, (void *)buffer, BUFFER_SIZE)) > 0) {

ANALYSIS SUMMARY:

Hits = 35
Lines analyzed = 1614 in approximately 0.07 seconds (24048 lines/second)
Physical Source Lines of Code (SLOC) = 1160
Hits@level = [0]  47 [1]  12 [2]  21 [3]   1 [4]   0 [5]   1
Hits@level+ = [0+]  82 [1+]  35 [2+]  23 [3+]   2 [4+]   1 [5+]   1
Hits/KSLOC@level+ = [0+] 70.6897 [1+] 30.1724 [2+] 19.8276 [3+] 1.72414 [4+] 0.862069 [5+] 0.862069
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.