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/wireguard-1.0.20200827/contrib/embeddable-wg-library/test.c
Examining data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c
Examining data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.h
Examining data/wireguard-1.0.20200827/contrib/extract-handshakes/offset-finder.c
Examining data/wireguard-1.0.20200827/contrib/extract-keys/config.c
Examining data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c
Examining data/wireguard-1.0.20200827/contrib/highlighter/fuzz.c
Examining data/wireguard-1.0.20200827/contrib/highlighter/gui/highlight.cpp
Examining data/wireguard-1.0.20200827/contrib/highlighter/highlight.c
Examining data/wireguard-1.0.20200827/contrib/highlighter/highlighter.c
Examining data/wireguard-1.0.20200827/contrib/highlighter/highlighter.h
Examining data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c
Examining data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-server.c
Examining data/wireguard-1.0.20200827/contrib/sticky-sockets/sticky-sockets.c
Examining data/wireguard-1.0.20200827/src/config.c
Examining data/wireguard-1.0.20200827/src/config.h
Examining data/wireguard-1.0.20200827/src/containers.h
Examining data/wireguard-1.0.20200827/src/ctype.h
Examining data/wireguard-1.0.20200827/src/curve25519-fiat32.h
Examining data/wireguard-1.0.20200827/src/curve25519-hacl64.h
Examining data/wireguard-1.0.20200827/src/curve25519.c
Examining data/wireguard-1.0.20200827/src/curve25519.h
Examining data/wireguard-1.0.20200827/src/encoding.c
Examining data/wireguard-1.0.20200827/src/encoding.h
Examining data/wireguard-1.0.20200827/src/fuzz/cmd.c
Examining data/wireguard-1.0.20200827/src/fuzz/config.c
Examining data/wireguard-1.0.20200827/src/fuzz/set.c
Examining data/wireguard-1.0.20200827/src/fuzz/setconf.c
Examining data/wireguard-1.0.20200827/src/fuzz/stringlist.c
Examining data/wireguard-1.0.20200827/src/fuzz/uapi.c
Examining data/wireguard-1.0.20200827/src/ipc-linux.h
Examining data/wireguard-1.0.20200827/src/ipc-openbsd.h
Examining data/wireguard-1.0.20200827/src/ipc-uapi-unix.h
Examining data/wireguard-1.0.20200827/src/ipc-uapi-windows.h
Examining data/wireguard-1.0.20200827/src/ipc-uapi.h
Examining data/wireguard-1.0.20200827/src/ipc.c
Examining data/wireguard-1.0.20200827/src/ipc.h
Examining data/wireguard-1.0.20200827/src/netlink.h
Examining data/wireguard-1.0.20200827/src/pubkey.c
Examining data/wireguard-1.0.20200827/src/set.c
Examining data/wireguard-1.0.20200827/src/setconf.c
Examining data/wireguard-1.0.20200827/src/show.c
Examining data/wireguard-1.0.20200827/src/showconf.c
Examining data/wireguard-1.0.20200827/src/subcommands.h
Examining data/wireguard-1.0.20200827/src/terminal.c
Examining data/wireguard-1.0.20200827/src/terminal.h
Examining data/wireguard-1.0.20200827/src/uapi/linux/linux/wireguard.h
Examining data/wireguard-1.0.20200827/src/uapi/openbsd/net/if_wg.h
Examining data/wireguard-1.0.20200827/src/version.h
Examining data/wireguard-1.0.20200827/src/wg-quick/android.c
Examining data/wireguard-1.0.20200827/src/wg.c
Examining data/wireguard-1.0.20200827/src/wincompat/compat.h
Examining data/wireguard-1.0.20200827/src/wincompat/include/arpa/inet.h
Examining data/wireguard-1.0.20200827/src/wincompat/include/net/if.h
Examining data/wireguard-1.0.20200827/src/wincompat/include/netdb.h
Examining data/wireguard-1.0.20200827/src/wincompat/include/netinet/in.h
Examining data/wireguard-1.0.20200827/src/wincompat/include/sys/socket.h
Examining data/wireguard-1.0.20200827/src/wincompat/init.c
Examining data/wireguard-1.0.20200827/src/wincompat/libc.c
Examining data/wireguard-1.0.20200827/src/genkey.c

FINAL RESULTS:

data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:42:2:  [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(full_cmd, 2047, line, args);
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:44:6:  [4] (shell) popen:
  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.
	f = popen(full_cmd, "r");
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:68:6:  [4] (shell) popen:
  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.
	f = popen(full_cmd, "r");
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:30:8:  [4] (format) snprintf:
  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.
	ret = snprintf(addr.sun_path, sizeof(addr.sun_path), SOCK_PATH "%s" SOCK_SUFFIX, iface);
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:72:6:  [4] (format) snprintf:
  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.
	if (snprintf(addr.sun_path, sizeof(addr.sun_path), SOCK_PATH "%s" SOCK_SUFFIX, iface) < 0)
data/wireguard-1.0.20200827/src/ipc-uapi-windows.h:66:8:  [4] (access) SetThreadToken:
  If this call fails, the program could fail to drop heightened privileges
  (CWE-250). Make sure the return value is checked, and do not continue if a
  failure is reported.
		if (!SetThreadToken(NULL, duplicated_token)) {
data/wireguard-1.0.20200827/src/show.c:125:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), (addr->sa_family == AF_INET6 && strchr(host, ':')) ? "[%s]:%s" : "%s:%s", host, service);
data/wireguard-1.0.20200827/src/show.c:144:13:  [4] (format) snprintf:
  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.
		offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "year%s" TERMINAL_RESET, offset ? ", " : "", years, years == 1 ? "" : "s");
data/wireguard-1.0.20200827/src/show.c:146:13:  [4] (format) snprintf:
  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.
		offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN  "day%s" TERMINAL_RESET, offset ? ", " : "", days, days == 1 ? "" : "s");
data/wireguard-1.0.20200827/src/show.c:148:13:  [4] (format) snprintf:
  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.
		offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN  "hour%s" TERMINAL_RESET, offset ? ", " : "", hours, hours == 1 ? "" : "s");
data/wireguard-1.0.20200827/src/show.c:150:13:  [4] (format) snprintf:
  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.
		offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "minute%s" TERMINAL_RESET, offset ? ", " : "", minutes, minutes == 1 ? "" : "s");
data/wireguard-1.0.20200827/src/show.c:152:13:  [4] (format) snprintf:
  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.
		offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN  "second%s" TERMINAL_RESET, offset ? ", " : "", seconds, seconds == 1 ? "" : "s");
data/wireguard-1.0.20200827/src/show.c:189:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), "%u " TERMINAL_FG_CYAN "B" TERMINAL_RESET, (unsigned int)b);
data/wireguard-1.0.20200827/src/show.c:191:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), "%.2f " TERMINAL_FG_CYAN "KiB" TERMINAL_RESET, (double)b / 1024);
data/wireguard-1.0.20200827/src/show.c:193:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), "%.2f " TERMINAL_FG_CYAN "MiB" TERMINAL_RESET, (double)b / (1024 * 1024));
data/wireguard-1.0.20200827/src/show.c:195:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), "%.2f " TERMINAL_FG_CYAN "GiB" TERMINAL_RESET, (double)b / (1024 * 1024 * 1024));
data/wireguard-1.0.20200827/src/show.c:197:3:  [4] (format) snprintf:
  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.
		snprintf(buf, sizeof(buf), "%.2f " TERMINAL_FG_CYAN "TiB" TERMINAL_RESET, (double)b / (1024 * 1024 * 1024) / 1024);
data/wireguard-1.0.20200827/src/terminal.c:38:3:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		vfprintf(stdout, fmt, args);
data/wireguard-1.0.20200827/src/terminal.h:49:66:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
void terminal_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
data/wireguard-1.0.20200827/src/wg-quick/android.c:36:46:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define _printf_(x, y) __attribute__((format(printf, x, y)))
data/wireguard-1.0.20200827/src/wg-quick/android.c:94:3:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
		strcat(ret, i);
data/wireguard-1.0.20200827/src/wg-quick/android.c:157:15:  [4] (shell) popen:
  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.
		c->stream = popen(cmd, "r");
data/wireguard-1.0.20200827/src/wg-quick/android.c:188: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.
	ret = system(cmd);
data/wireguard-1.0.20200827/src/wg-quick/android.c:220:2:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	vprintf(ndc_fmt, args);
data/wireguard-1.0.20200827/src/wg-quick/android.c:627:2:  [4] (shell) execvp:
  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.
	execvp("su", args);
data/wireguard-1.0.20200827/src/wg-quick/android.c:880:3:  [4] (format) snprintf:
  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.
		snprintf(arg, len + 2, (is_ip ? dns_function_arglist[0] : dns_search_function_arglist[0]) == '\0' ? "%s" : ", %s", dns);
data/wireguard-1.0.20200827/src/wg-quick/android.c:1052:18:  [4] (shell) popen:
  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.
	config_writer = popen(cmd, "w");
data/wireguard-1.0.20200827/src/config.c:180:18:  [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.
	char *retries = getenv("WG_ENDPOINT_RESOLUTION_RETRIES"), *end;
data/wireguard-1.0.20200827/src/show.c:87:20:  [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.
	const char *var = getenv("WG_HIDE_KEYS");
data/wireguard-1.0.20200827/src/terminal.c:22:8:  [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.
	var = getenv("WG_COLOR_MODE");
data/wireguard-1.0.20200827/src/wg-quick/android.c:717:2:  [3] (random) srandom:
  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.
	srandom(time(NULL) ^ getpid()); /* Not real randomness. */
data/wireguard-1.0.20200827/src/wg-quick/android.c:720:12:  [3] (random) random:
  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.
		*netid = random() & 0xfffe;
data/wireguard-1.0.20200827/src/wg-quick/android.c:1068:20:  [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.
	const char *pkg = getenv("CALLING_PACKAGE");
data/wireguard-1.0.20200827/src/wincompat/init.c:31: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.
	colormode = getenv("WG_COLOR_MODE");
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:366: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(mnl_attr_get_payload(attr), data, len);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:884: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(list->buffer + list->len, str, len);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1490:27:  [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 void encode_base64(char dest[static 4], const uint8_t src[static 3])
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1515:32:  [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 int decode_base64(const char src[static 4])
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1649: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(o, t, sizeof(fe));
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1667: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(o, c, sizeof(fe));
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1745: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("/dev/urandom", O_RDONLY);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.h:17: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.
typedef char wg_key_b64_string[((sizeof(wg_key) + 2) / 3) * 4 + 1];
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.h:72: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 name[IFNAMSIZ];
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:21: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("/dev/kmem", O_RDONLY);
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:56:12:  [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 *f = fopen("/proc/net/udp", "r");
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:57: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 line[256], *ptr;
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:59: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 name[IFNAMSIZ + 1] = { 0 };
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:90:11:  [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.
	unsigned char sending[32], receiving[32];
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:91: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 sending_b64[45], receiving_b64[45];
data/wireguard-1.0.20200827/contrib/highlighter/highlight.c:63: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 input[1024 * 1024];
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:36: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[2048];
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:37: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 full_cmd[2048] = { 0 };
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:64: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 full_cmd[2048] = { 0 };
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:93: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(dstkey, buf, 32);
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:164: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).
	packet.udp.source = htons(atoi(cmd("wg show %s listen-port", interface)));
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-server.c:47: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(entry->pubkey, key, 32);
data/wireguard-1.0.20200827/contrib/sticky-sockets/sticky-sockets.c:260: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 srcaddr[40], dstaddr[40];
data/wireguard-1.0.20200827/src/config.c:121: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 dst[WG_KEY_LEN_BASE64];
data/wireguard-1.0.20200827/src/config.c:124: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(path, "r");
data/wireguard-1.0.20200827/src/config.c:270: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(endpoint, resolved->ai_addr, resolved->ai_addrlen);
data/wireguard-1.0.20200827/src/containers.h: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 name[IFNAMSIZ];
data/wireguard-1.0.20200827/src/curve25519-fiat32.h:762: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(e, scalar, 32);
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:283: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(output, input, 5 * sizeof(*input));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:355: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(tmp, b, 5 * sizeof(*b));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:471: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(output, input, 5 * sizeof(*input));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:472: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(output + 5, input + 5, 5 * sizeof(*input));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:495: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(origx, x, 5 * sizeof(*x));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:498: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(origxprime0, xprime, 5 * sizeof(*xprime));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:515: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(origxprime, xxprime, 5 * sizeof(*xxprime));
data/wireguard-1.0.20200827/src/curve25519-hacl64.h:769: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(e, secret, 32);
data/wireguard-1.0.20200827/src/encoding.c:11:34:  [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 inline void encode_base64(char dest[static 4], const uint8_t src[static 3])
data/wireguard-1.0.20200827/src/encoding.c:24:20:  [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.
void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[static WG_KEY_LEN])
data/wireguard-1.0.20200827/src/encoding.c:35:39:  [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 inline int decode_base64(const char src[static 4])
data/wireguard-1.0.20200827/src/encoding.c:74:17:  [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.
void key_to_hex(char hex[static WG_KEY_LEN_HEX], const uint8_t key[static WG_KEY_LEN])
data/wireguard-1.0.20200827/src/encoding.h:16:20:  [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.
void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[static WG_KEY_LEN]);
data/wireguard-1.0.20200827/src/encoding.h:19:17:  [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.
void key_to_hex(char hex[static WG_KEY_LEN_HEX], const uint8_t key[static WG_KEY_LEN]);
data/wireguard-1.0.20200827/src/fuzz/cmd.c:22: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 *argv[8192] = { 0 }, *args;
data/wireguard-1.0.20200827/src/fuzz/cmd.c:27:21:  [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).
		assert((devnull = fopen("/dev/null", "r+")));
data/wireguard-1.0.20200827/src/fuzz/cmd.c:32: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(args, data, data_len);
data/wireguard-1.0.20200827/src/fuzz/config.c:35: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(input, data + 1, len - 1);
data/wireguard-1.0.20200827/src/fuzz/set.c:16:9:  [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).
#define fopen hacked_fopen
data/wireguard-1.0.20200827/src/fuzz/set.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 *argv[8192] = { "set", "wg0" }, *args;
data/wireguard-1.0.20200827/src/fuzz/set.c:46: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(args, data, data_len);
data/wireguard-1.0.20200827/src/fuzz/setconf.c:17:9:  [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).
#define fopen hacked_fopen
data/wireguard-1.0.20200827/src/fuzz/setconf.c:19: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).
#undef fopen
data/wireguard-1.0.20200827/src/fuzz/setconf.c:46: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 strptr[32];
data/wireguard-1.0.20200827/src/fuzz/setconf.c:47: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 *argv[3] = { "setconf", "wg0", strptr };
data/wireguard-1.0.20200827/src/fuzz/stringlist.c:33: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(interfaces, data, data_len);
data/wireguard-1.0.20200827/src/fuzz/uapi.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 ifname[IFNAMSIZ];
data/wireguard-1.0.20200827/src/fuzz/uapi.c:41: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(hack->ifname, "hack", 5);
data/wireguard-1.0.20200827/src/genkey.c:53: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("/dev/urandom", O_RDONLY);
data/wireguard-1.0.20200827/src/genkey.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 base64[WG_KEY_LEN_BASE64];
data/wireguard-1.0.20200827/src/ipc-openbsd.h:141: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(&peer->endpoint.addr, &wg_peer->p_sa, wg_peer->p_sa.sa_len);
data/wireguard-1.0.20200827/src/ipc-openbsd.h:241: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(&wg_peer->p_endpoint, &peer->endpoint.addr, peer->endpoint.addr.sa_len);
data/wireguard-1.0.20200827/src/ipc-uapi-windows.h:16: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 fname[MAX_PATH], error_message[1024 * 128] = { 0 };
data/wireguard-1.0.20200827/src/ipc-uapi.h:29: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 hex[WG_KEY_LEN_HEX], ip[INET6_ADDRSTRLEN], host[4096 + 1], service[512 + 1];
data/wireguard-1.0.20200827/src/ipc-uapi.h:213: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(&peer->endpoint.addr, resolved->ai_addr, resolved->ai_addrlen);
data/wireguard-1.0.20200827/src/ipc.c:36: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(list->buffer + list->len, str, len);
data/wireguard-1.0.20200827/src/netlink.h:314: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(mnl_attr_get_payload(attr), data, len);
data/wireguard-1.0.20200827/src/pubkey.c:17: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 base64[WG_KEY_LEN_BASE64];
data/wireguard-1.0.20200827/src/setconf.c:89: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(peer->public_key, pubkeys[i].pubkey, WG_KEY_LEN);
data/wireguard-1.0.20200827/src/setconf.c:115:17:  [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).
	config_input = fopen(argv[2], "r");
data/wireguard-1.0.20200827/src/show.c:70:8:  [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 *key(const uint8_t key[static WG_KEY_LEN])
data/wireguard-1.0.20200827/src/show.c:72: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 base64[WG_KEY_LEN_BASE64];
data/wireguard-1.0.20200827/src/show.c:78:8:  [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 *maybe_key(const uint8_t maybe_key[static WG_KEY_LEN], bool have_it)
data/wireguard-1.0.20200827/src/show.c:85:8:  [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 *masked_key(const uint8_t masked_key[static WG_KEY_LEN])
data/wireguard-1.0.20200827/src/show.c:96: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[INET6_ADDRSTRLEN + 1];
data/wireguard-1.0.20200827/src/show.c:108: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 host[4096 + 1];
data/wireguard-1.0.20200827/src/show.c:109: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 service[512 + 1];
data/wireguard-1.0.20200827/src/show.c:110: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[sizeof(host) + sizeof(service) + 4];
data/wireguard-1.0.20200827/src/show.c:159: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[1024];
data/wireguard-1.0.20200827/src/show.c:178: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[1024] = "every ";
data/wireguard-1.0.20200827/src/show.c:186: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[1024];
data/wireguard-1.0.20200827/src/showconf.c:23: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 base64[WG_KEY_LEN_BASE64];
data/wireguard-1.0.20200827/src/showconf.c:24: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 ip[INET6_ADDRSTRLEN];
data/wireguard-1.0.20200827/src/showconf.c:76: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 host[4096 + 1];
data/wireguard-1.0.20200827/src/showconf.c:77: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 service[512 + 1];
data/wireguard-1.0.20200827/src/uapi/openbsd/net/if_wg.h:87: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	 		 wgd_name[IFNAMSIZ];
data/wireguard-1.0.20200827/src/wg-quick/android.c:233:15:  [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).
	error_code = atoi(ret);
data/wireguard-1.0.20200827/src/wg-quick/android.c:612: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 *args[argc + 4];
data/wireguard-1.0.20200827/src/wg-quick/android.c:620: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(&args[3], argv, argc * sizeof(*args));
data/wireguard-1.0.20200827/src/wg-quick/android.c:755:17:  [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).
	package_list = fopen("/data/system/packages.list", "r");
data/wireguard-1.0.20200827/src/wg-quick/android.c:790: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 range[22];
data/wireguard-1.0.20200827/src/wg-quick/android.c:936:11:  [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).
			mask = atoi(slash + 1);
data/wireguard-1.0.20200827/src/wg-quick/android.c:986:9:  [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).
	return atoi(mtu);
data/wireguard-1.0.20200827/src/wg-quick/android.c:1191:11:  [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 = fopen(filename, "r");
data/wireguard-1.0.20200827/src/wg-quick/android.c:1202:10:  [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 = fopen(filename, "r");
data/wireguard-1.0.20200827/src/wg-quick/android.c:1254: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).
				*mtu = atoi(clean + 4);
data/wireguard-1.0.20200827/src/wincompat/libc.c:77: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 s[INET6_ADDRSTRLEN + 1];
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:385:26:  [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).
	mnl_attr_put(nlh, type, strlen(data)+1, data);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:867: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) + 1;
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1349:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(device->name, mnl_attr_get_str(attr), sizeof(device->name) - 1);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1537:6:  [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 (strlen(base64) != sizeof(wg_key_b64_string) - 1 || base64[sizeof(wg_key_b64_string) - 2] != '=') {
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.c:1748:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ret = read(fd, preshared_key + i, sizeof(wg_key) - i);
data/wireguard-1.0.20200827/contrib/embeddable-wg-library/wireguard.h:86:108:  [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).
#define wg_for_each_device_name(__names, __name, __len) for ((__name) = (__names), (__len) = 0; ((__len) = strlen(__name)); (__name) += (__len) + 1)
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:34:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(fd, buffer, len) != len) {
data/wireguard-1.0.20200827/contrib/extract-keys/extract-keys.c:68: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).
		ptr = line + strlen(line) - 1;
data/wireguard-1.0.20200827/contrib/highlighter/highlighter.c:35: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(c);
data/wireguard-1.0.20200827/contrib/highlighter/highlighter.c:44: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(c);
data/wireguard-1.0.20200827/contrib/highlighter/highlighter.c:577:36:  [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).
	const string_span_t s = { config, strlen(config) };
data/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:54: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/wireguard-1.0.20200827/contrib/nat-hole-punching/nat-punch-client.c:76: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(peers[total_peers].base64_key);
data/wireguard-1.0.20200827/src/config.c:27:19:  [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 linelen = strlen(line);
data/wireguard-1.0.20200827/src/config.c:28:18:  [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 keylen = strlen(key);
data/wireguard-1.0.20200827/src/config.c:50:7:  [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 (!strlen(value)) {
data/wireguard-1.0.20200827/src/config.c:92:6:  [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 (strlen(value) > 2 && value[0] == '0' && value[1] == 'x')
data/wireguard-1.0.20200827/src/config.c:143:14:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while ((c = getc(f)) != EOF) {
data/wireguard-1.0.20200827/src/config.c:210:7:  [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 (!strlen(value)) {
data/wireguard-1.0.20200827/src/config.c:265:3:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
		usleep(timeout);
data/wireguard-1.0.20200827/src/config.c:350:7:  [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 (!strlen(value)) {
data/wireguard-1.0.20200827/src/config.c:494: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(input);
data/wireguard-1.0.20200827/src/config.c:551:6:  [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).
	t = strlen(in);
data/wireguard-1.0.20200827/src/encoding.c:56:6:  [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 (strlen(base64) != WG_KEY_LEN_BASE64 - 1 || base64[WG_KEY_LEN_BASE64 - 2] != '=')
data/wireguard-1.0.20200827/src/encoding.c:90:6:  [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 (strlen(hex) != WG_KEY_LEN_HEX - 1)
data/wireguard-1.0.20200827/src/fuzz/cmd.c:36:76:  [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).
	for (const char *arg = args; argc < 8192 && arg - args < data_len; arg += strlen(arg) + 1) {
data/wireguard-1.0.20200827/src/fuzz/cmd.c:55:10:  [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).
		arg += strlen(arg) + 1;
data/wireguard-1.0.20200827/src/fuzz/cmd.c:57:10:  [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).
		arg += strlen(arg) + 1;
data/wireguard-1.0.20200827/src/fuzz/set.c:34:36:  [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).
	return fmemopen((char *)pathname, strlen(pathname), "r");
data/wireguard-1.0.20200827/src/fuzz/stringlist.c:36:85:  [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).
	for (char *interface = interfaces; interface - interfaces < data_len; interface += strlen(interface) + 1)
data/wireguard-1.0.20200827/src/fuzz/stringlist.c:43:27:  [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).
			assert(!interface2 || !strlen(interface2));
data/wireguard-1.0.20200827/src/fuzz/stringlist.c:46: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(interface);
data/wireguard-1.0.20200827/src/fuzz/stringlist.c:51:10:  [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).
		assert(strlen(interface2) == len);
data/wireguard-1.0.20200827/src/genkey.c:57:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ret = read(fd, out + i, len - i);
data/wireguard-1.0.20200827/src/ipc-linux.h:418:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(device->name, mnl_attr_get_str(attr), sizeof(device->name) - 1);
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:103: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(ent->d_name);
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:104:14:  [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 (len <= strlen(SOCK_SUFFIX))
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:106:28:  [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).
		end = &ent->d_name[len - strlen(SOCK_SUFFIX)];
data/wireguard-1.0.20200827/src/ipc-uapi-unix.h:107: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 (strncmp(end, SOCK_SUFFIX, strlen(SOCK_SUFFIX)))
data/wireguard-1.0.20200827/src/ipc-uapi-windows.h:127:44:  [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 (strncmp(prefix, find_data.cFileName, strlen(prefix)))
data/wireguard-1.0.20200827/src/ipc-uapi-windows.h:129:53:  [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).
		ret = string_list_add(list, find_data.cFileName + strlen(prefix));
data/wireguard-1.0.20200827/src/ipc-uapi.h:138:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(dev->name, iface, IFNAMSIZ - 1);
data/wireguard-1.0.20200827/src/ipc-uapi.h:142:14:  [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).
		line_len = strlen(key);
data/wireguard-1.0.20200827/src/ipc-uapi.h:190: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).
			if (!strlen(value))
data/wireguard-1.0.20200827/src/ipc.c:19: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) + 1;
data/wireguard-1.0.20200827/src/netlink.h:333:26:  [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).
	mnl_attr_put(nlh, type, strlen(data)+1, data);
data/wireguard-1.0.20200827/src/pubkey.c:33:19:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		trailing_char = getc(stdin);
data/wireguard-1.0.20200827/src/set.c:28:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(device->name, argv[1], IFNAMSIZ -  1);
data/wireguard-1.0.20200827/src/setconf.c:135:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(device->name, argv[1], IFNAMSIZ - 1);
data/wireguard-1.0.20200827/src/show.c:122:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(buf, gai_strerror(ret), sizeof(buf) - 1);
data/wireguard-1.0.20200827/src/show.c:164:3:  [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.
		strncpy(buf, "Now", sizeof(buf) - 1);
data/wireguard-1.0.20200827/src/show.c:166:3:  [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.
		strncpy(buf, "(" TERMINAL_FG_RED "System clock wound backward; connection problems may ensue." TERMINAL_RESET ")", sizeof(buf) - 1);
data/wireguard-1.0.20200827/src/show.c:169:3:  [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.
		strncpy(buf + offset, " ago", sizeof(buf) - offset - 1);
data/wireguard-1.0.20200827/src/show.c:180:20:  [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).
	pretty_time(buf + strlen("every "), sizeof(buf) - strlen("every ") - 1, seconds);
data/wireguard-1.0.20200827/src/show.c:180:52:  [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).
	pretty_time(buf + strlen("every "), sizeof(buf) - strlen("every ") - 1, seconds);
data/wireguard-1.0.20200827/src/show.c:399:31:  [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).
		for (size_t len = 0; (len = strlen(interface)); interface += len + 1) {
data/wireguard-1.0.20200827/src/show.c:414: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).
				if (strlen(interface + len + 1))
data/wireguard-1.0.20200827/src/show.c:434:31:  [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).
		for (size_t len = 0; (len = strlen(interface)); interface += len + 1)
data/wireguard-1.0.20200827/src/show.c:435:30:  [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).
			printf("%s%c", interface, strlen(interface + len + 1) ? ' ' : '\n');
data/wireguard-1.0.20200827/src/terminal.c:59: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).
		for (j = i + strlen(&str[i]); j < len; ++j) {
data/wireguard-1.0.20200827/src/wg-quick/android.c:86:10:  [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(i);
data/wireguard-1.0.20200827/src/wg-quick/android.c:381: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).
	return str ? strlen(str) : -1;
data/wireguard-1.0.20200827/src/wg-quick/android.c:396:31:  [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).
	*out_length = array[index] ? strlen(array[index]) : -1;
data/wireguard-1.0.20200827/src/wg-quick/android.c:777:21:  [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 (token_len && strlen(package_name) == token_len && !strncmp(start, package_name, token_len))
data/wireguard-1.0.20200827/src/wg-quick/android.c:836: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(dnses);
data/wireguard-1.0.20200827/src/wg-quick/android.c:879:3:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
		strncat(is_ip ? dns_shell_arglist : dns_search_shell_arglist, arg, len * 4 - 1);
data/wireguard-1.0.20200827/src/wg-quick/android.c:881:3:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings.
		strncat(is_ip ? dns_function_arglist : dns_search_function_arglist, arg, len * 4 - 1);
data/wireguard-1.0.20200827/src/wg-quick/android.c:1225: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).
		size_t len = strlen(line), j = 0;
data/wireguard-1.0.20200827/src/wincompat/libc.c:38:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		int c = fgetc(fp);
data/wireguard-1.0.20200827/src/wincompat/libc.c:79:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(s, src, INET6_ADDRSTRLEN + 1);

ANALYSIS SUMMARY:

Hits = 199
Lines analyzed = 11897 in approximately 0.34 seconds (34961 lines/second)
Physical Source Lines of Code (SLOC) = 10055
Hits@level = [0] 189 [1]  70 [2]  95 [3]   7 [4]  27 [5]   0
Hits@level+ = [0+] 388 [1+] 199 [2+] 129 [3+]  34 [4+]  27 [5+]   0
Hits/KSLOC@level+ = [0+] 38.5878 [1+] 19.7911 [2+] 12.8294 [3+] 3.3814 [4+] 2.68523 [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.