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/libcap-ng-0.7.9/src/captab.h
Examining data/libcap-ng-0.7.9/src/cap-ng.h
Examining data/libcap-ng-0.7.9/src/test/lib_test.c
Examining data/libcap-ng-0.7.9/src/test/thread_test.c
Examining data/libcap-ng-0.7.9/src/lookup_table.c
Examining data/libcap-ng-0.7.9/src/cap-ng.c
Examining data/libcap-ng-0.7.9/utils/filecap.c
Examining data/libcap-ng-0.7.9/utils/captest.c
Examining data/libcap-ng-0.7.9/utils/proc-llist.c
Examining data/libcap-ng-0.7.9/utils/pscap.c
Examining data/libcap-ng-0.7.9/utils/netcap.c
Examining data/libcap-ng-0.7.9/utils/proc-llist.h

FINAL RESULTS:

data/libcap-ng-0.7.9/utils/netcap.c:180:16:  [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.
			if ((llen = readlink(ln, line, sizeof(line)-1)) < 0)
data/libcap-ng-0.7.9/src/cap-ng.c:997:12:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
					len = sprintf(ptr+cnt, "%s", n);
data/libcap-ng-0.7.9/src/cap-ng.c:1000:12:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
					len = sprintf(ptr+cnt, ", %s", n);
data/libcap-ng-0.7.9/utils/captest.c:178:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
		if (access("/etc/shadow", R_OK) == 0)
data/libcap-ng-0.7.9/utils/captest.c:185:8:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
		rc = system("cat /etc/shadow > /dev/null 2>&1");
data/libcap-ng-0.7.9/utils/captest.c:191:4:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			system("/usr/bin/captest --no-child --text");
data/libcap-ng-0.7.9/utils/captest.c:193:4:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			system("/usr/bin/captest --no-child");
data/libcap-ng-0.7.9/utils/filecap.c:168:14:  [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.
		path_env = getenv("PATH");
data/libcap-ng-0.7.9/src/cap-ng.c:212:8:  [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/cap_last_cap", O_RDONLY);
data/libcap-ng-0.7.9/src/cap-ng.c:219: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[8];
data/libcap-ng-0.7.9/src/cap-ng.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[64];
data/libcap-ng-0.7.9/src/cap-ng.c:308:6:  [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).
	f = fopen(buf, "re");
data/libcap-ng-0.7.9/src/cap-ng.c:1019: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(ptr, &m, sizeof(m));
data/libcap-ng-0.7.9/src/lookup_table.c:56:18:  [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.
#define _S(n, s) char MSGSTRFIELD(__LINE__)[sizeof (s)];
data/libcap-ng-0.7.9/src/lookup_table.c:60: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 str[0];
data/libcap-ng-0.7.9/src/test/lib_test.c:36: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/cap_last_cap", O_RDONLY);
data/libcap-ng-0.7.9/src/test/lib_test.c:40: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 buf[8];
data/libcap-ng-0.7.9/utils/filecap.c:59: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).
	int fd = open(fpath, O_RDONLY|O_CLOEXEC);
data/libcap-ng-0.7.9/utils/filecap.c:191: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).
		int fd = open(path, O_WRONLY|O_NOFOLLOW|O_CLOEXEC);
data/libcap-ng-0.7.9/utils/netcap.c:61: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 buf[100];
data/libcap-ng-0.7.9/utils/netcap.c:62: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 *tmp, cmd[16], state, *text, *bounds;
data/libcap-ng-0.7.9/utils/netcap.c:75:8:  [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(buf, O_RDONLY|O_CLOEXEC, 0);
data/libcap-ng-0.7.9/utils/netcap.c:116:8:  [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).
		sf = fopen(buf, "rte");
data/libcap-ng-0.7.9/utils/netcap.c:172: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 line[256], ln[256], *s, *e;
data/libcap-ng-0.7.9/utils/netcap.c:268: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/libcap-ng-0.7.9/utils/netcap.c:271: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 rem_addr[128], local_addr[128], more[512];
data/libcap-ng-0.7.9/utils/netcap.c:273:6:  [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).
	f = fopen(proc, "rte");
data/libcap-ng-0.7.9/utils/netcap.c:302: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/libcap-ng-0.7.9/utils/netcap.c:305: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 rem_addr[128], local_addr[128], more[512];
data/libcap-ng-0.7.9/utils/netcap.c:307:6:  [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).
	f = fopen(proc, "rte");
data/libcap-ng-0.7.9/utils/netcap.c:336: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/libcap-ng-0.7.9/utils/netcap.c:339: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 rem_addr[128], local_addr[128], more[512];
data/libcap-ng-0.7.9/utils/netcap.c:341:6:  [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).
	f = fopen(proc, "rte");
data/libcap-ng-0.7.9/utils/netcap.c:371: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], more[256];
data/libcap-ng-0.7.9/utils/netcap.c:379:6:  [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).
	f = fopen("/proc/net/dev", "rte");
data/libcap-ng-0.7.9/utils/netcap.c:406: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/libcap-ng-0.7.9/utils/netcap.c:409: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 more[256], ifc[32];
data/libcap-ng-0.7.9/utils/netcap.c:411:6:  [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).
	f = fopen("/proc/net/packet", "rte");
data/libcap-ng-0.7.9/utils/pscap.c:68: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 buf[100];
data/libcap-ng-0.7.9/utils/pscap.c:69: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 *tmp, cmd[16], state, *name = NULL;
data/libcap-ng-0.7.9/utils/pscap.c:87:8:  [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(buf, O_RDONLY|O_CLOEXEC, 0);
data/libcap-ng-0.7.9/utils/pscap.c:124:8:  [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).
			f = fopen(buf, "rte");
data/libcap-ng-0.7.9/src/cap-ng.c:220:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int num = read(fd, buf, sizeof(buf) - 1);
data/libcap-ng-0.7.9/src/cap-ng.c:962: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).
				s = ptr + strlen(ptr);
data/libcap-ng-0.7.9/src/test/lib_test.c:41:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		int num = read(fd, buf, sizeof(buf));
data/libcap-ng-0.7.9/src/test/lib_test.c:72:8:  [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(text);
data/libcap-ng-0.7.9/utils/netcap.c:78:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		len = read(fd, buf, sizeof buf - 1);
data/libcap-ng-0.7.9/utils/netcap.c:287:3:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		sscanf(buf, "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X "
data/libcap-ng-0.7.9/utils/netcap.c:321:3:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		sscanf(buf, "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X "
data/libcap-ng-0.7.9/utils/netcap.c:355:3:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		sscanf(buf, "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X "
data/libcap-ng-0.7.9/utils/netcap.c:390:4:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
			sscanf(buf, "%16s: %255s\n", ifc, more);
data/libcap-ng-0.7.9/utils/netcap.c:425:3:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		sscanf(buf, "%lX %u %u %X %u %u %u %u %lu %255s\n",
data/libcap-ng-0.7.9/utils/pscap.c:90:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		len = read(fd, buf, sizeof buf - 1);

ANALYSIS SUMMARY:

Hits = 53
Lines analyzed = 2860 in approximately 0.17 seconds (16960 lines/second)
Physical Source Lines of Code (SLOC) = 2207
Hits@level = [0] 119 [1]  11 [2]  34 [3]   1 [4]   6 [5]   1
Hits@level+ = [0+] 172 [1+]  53 [2+]  42 [3+]   8 [4+]   7 [5+]   1
Hits/KSLOC@level+ = [0+] 77.9338 [1+] 24.0145 [2+] 19.0304 [3+] 3.62483 [4+] 3.17173 [5+] 0.453104
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.