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/plotnetcfg-0.4.1/args.c
Examining data/plotnetcfg-0.4.1/args.h
Examining data/plotnetcfg-0.4.1/compat.h
Examining data/plotnetcfg-0.4.1/ethtool.c
Examining data/plotnetcfg-0.4.1/ethtool.h
Examining data/plotnetcfg-0.4.1/frontend.c
Examining data/plotnetcfg-0.4.1/frontend.h
Examining data/plotnetcfg-0.4.1/frontends/dot.c
Examining data/plotnetcfg-0.4.1/frontends/dot.h
Examining data/plotnetcfg-0.4.1/frontends/json.c
Examining data/plotnetcfg-0.4.1/frontends/json.h
Examining data/plotnetcfg-0.4.1/handler.c
Examining data/plotnetcfg-0.4.1/handler.h
Examining data/plotnetcfg-0.4.1/handlers/bridge.c
Examining data/plotnetcfg-0.4.1/handlers/bridge.h
Examining data/plotnetcfg-0.4.1/handlers/master.c
Examining data/plotnetcfg-0.4.1/handlers/master.h
Examining data/plotnetcfg-0.4.1/handlers/openvswitch.c
Examining data/plotnetcfg-0.4.1/handlers/openvswitch.h
Examining data/plotnetcfg-0.4.1/handlers/veth.c
Examining data/plotnetcfg-0.4.1/handlers/veth.h
Examining data/plotnetcfg-0.4.1/handlers/vlan.c
Examining data/plotnetcfg-0.4.1/handlers/vlan.h
Examining data/plotnetcfg-0.4.1/if.c
Examining data/plotnetcfg-0.4.1/if.h
Examining data/plotnetcfg-0.4.1/label.c
Examining data/plotnetcfg-0.4.1/label.h
Examining data/plotnetcfg-0.4.1/main.c
Examining data/plotnetcfg-0.4.1/match.c
Examining data/plotnetcfg-0.4.1/match.h
Examining data/plotnetcfg-0.4.1/netlink.c
Examining data/plotnetcfg-0.4.1/netlink.h
Examining data/plotnetcfg-0.4.1/netns.c
Examining data/plotnetcfg-0.4.1/netns.h
Examining data/plotnetcfg-0.4.1/tunnel.c
Examining data/plotnetcfg-0.4.1/tunnel.h
Examining data/plotnetcfg-0.4.1/utils.c
Examining data/plotnetcfg-0.4.1/utils.h

FINAL RESULTS:

data/plotnetcfg-0.4.1/netns.c:45: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(path, dest, sizeof(dest));
data/plotnetcfg-0.4.1/ethtool.c:40:2:  [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(ifr.ifr_name, ifname);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:77:19:  [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.
	struct ovs_port *system;
data/plotnetcfg-0.4.1/handlers/openvswitch.c:587:12:  [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.
		if (!br->system || !br->system->iface_count)
data/plotnetcfg-0.4.1/handlers/openvswitch.c:598:20:  [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.
			if (port == br->system)
data/plotnetcfg-0.4.1/args.c:75: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.
		gshort_index = getopt_long(argc, argv, gshort, glong, &glong_index);
data/plotnetcfg-0.4.1/args.c:100:28:  [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).
				*opt->action.int_var = atoi(optarg);
data/plotnetcfg-0.4.1/handlers/bridge.c:39: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[37 + IFNAMSIZ + 1];
data/plotnetcfg-0.4.1/handlers/bridge.c:44: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(buf, O_RDONLY);
data/plotnetcfg-0.4.1/handlers/bridge.c:59:24:  [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).
	entry->master_index = atoi(buf);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:495: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[IFNAMSIZ + 4 + 1];
data/plotnetcfg-0.4.1/handlers/openvswitch.c:534:15:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
		ptr = buf + sprintf(buf, "trunks %u", port->trunks[0]);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:536:11:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
			ptr += sprintf(ptr, ", %u", port->trunks[i]);
data/plotnetcfg-0.4.1/if.c:78: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/plotnetcfg-0.4.1/if.c:86: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(dest->raw, RTA_DATA(rta), len);
data/plotnetcfg-0.4.1/netlink.c:104: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[16384];
data/plotnetcfg-0.4.1/netlink.c:140: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(&entry->h, n, n->nlmsg_len);
data/plotnetcfg-0.4.1/netlink.c:187: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(*dest, orig, orig_len);
data/plotnetcfg-0.4.1/netlink.c:191: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(nla + 1, str, len);
data/plotnetcfg-0.4.1/netns.c:41: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 dest[PATH_MAX], *s, *endptr;
data/plotnetcfg-0.4.1/netns.c:78: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/plotnetcfg-0.4.1/netns.c:87:14:  [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).
	entry->fd = open(path, O_RDONLY);
data/plotnetcfg-0.4.1/netns.c:113: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], buf[PATH_MAX];
data/plotnetcfg-0.4.1/netns.c:118: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).
	commfd = open(path, O_RDONLY);
data/plotnetcfg-0.4.1/netns.c:143: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/plotnetcfg-0.4.1/netns.c:153:8:  [2] (integer) atol:
  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 = atol(spid);
data/plotnetcfg-0.4.1/netns.c:169:14:  [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).
	entry->fd = open(path, O_RDONLY);
data/plotnetcfg-0.4.1/netns.c:188:17:  [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).
		(*root)->fd = open("/proc/1/ns/net", O_RDONLY);
data/plotnetcfg-0.4.1/netns.c:411: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/1/ns/net", O_RDONLY);
data/plotnetcfg-0.4.1/tunnel.c:27: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 raw[16];
data/plotnetcfg-0.4.1/utils.c:45: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 buf[IFNAMSIZ + NAME_MAX + 2];
data/plotnetcfg-0.4.1/utils.c:57: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 buf[IFNAMSIZ + 2 * NAME_MAX + 6 + 1];
data/plotnetcfg-0.4.1/args.c:129: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(dest);
data/plotnetcfg-0.4.1/handlers/bridge.c:50:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	res = read(fd, buf, sizeof(buf));
data/plotnetcfg-0.4.1/handlers/openvswitch.c:355:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(sun.sun_path, db, UNIX_PATH_MAX);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:357:64:  [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).
	connect(fd, (struct sockaddr *)&sun, sizeof(sun.sun_family) + strlen(sun.sun_path) + 1);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:372:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		res = read(fd, buf + len, CHUNK);
data/plotnetcfg-0.4.1/handlers/openvswitch.c:645: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(str);
data/plotnetcfg-0.4.1/if.c:90: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(buf);
data/plotnetcfg-0.4.1/netlink.c:179:12:  [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).
	int len = strlen(str) + 1;
data/plotnetcfg-0.4.1/netns.c:121:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		len = read(commfd, path, sizeof(path));

ANALYSIS SUMMARY:

Hits = 41
Lines analyzed = 4029 in approximately 0.11 seconds (37085 lines/second)
Physical Source Lines of Code (SLOC) = 2952
Hits@level = [0]  54 [1]   9 [2]  26 [3]   1 [4]   4 [5]   1
Hits@level+ = [0+]  95 [1+]  41 [2+]  32 [3+]   6 [4+]   5 [5+]   1
Hits/KSLOC@level+ = [0+] 32.1816 [1+] 13.8889 [2+] 10.8401 [3+] 2.03252 [4+] 1.69377 [5+] 0.338753
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.