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/netcat-openbsd-1.217/atomicio.c
Examining data/netcat-openbsd-1.217/atomicio.h
Examining data/netcat-openbsd-1.217/socks.c
Examining data/netcat-openbsd-1.217/netcat.c

FINAL RESULTS:

data/netcat-openbsd-1.217/netcat.c:276:15:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
	while ((ch = getopt(argc, argv,
data/netcat-openbsd-1.217/netcat.c:183:1:  [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 Sflag_password[TCP_MD5SIG_MAXKEYLEN];
data/netcat-openbsd-1.217/netcat.c:188:1:  [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 *portlist[PORT_MAX+1];
data/netcat-openbsd-1.217/netcat.c:247: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 ipaddr[NI_MAXHOST];
data/netcat-openbsd-1.217/netcat.c:258: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 unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
data/netcat-openbsd-1.217/netcat.c:444:22:  [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).
			else if ((Zflag = fopen(optarg, "w")) == NULL)
data/netcat-openbsd-1.217/netcat.c:628:8:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
			if (mkstemp(unix_dg_tmp_socket_buf) == -1)
data/netcat-openbsd-1.217/netcat.c:782: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 buf[2048];
data/netcat-openbsd-1.217/netcat.c:916:16:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
					    ntohs(atoi(portlist[i])),
data/netcat-openbsd-1.217/netcat.c:1449: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 netinbuf[BUFSIZE];
data/netcat-openbsd-1.217/netcat.c:1451: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 stdinbuf[BUFSIZE];
data/netcat-openbsd-1.217/netcat.c:1756: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[CMSG_SPACE(sizeof(int))];
data/netcat-openbsd-1.217/netcat.c:1810: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 obuf[4];
data/netcat-openbsd-1.217/netcat.c:1964: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(&sig.tcpm_addr, sa, sizeof(struct sockaddr_storage));
data/netcat-openbsd-1.217/netcat.c:1968: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(sig.tcpm_key, Sflag_password, sig.tcpm_keylen);
data/netcat-openbsd-1.217/netcat.c:2210: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[NI_MAXHOST], port[NI_MAXSERV];
data/netcat-openbsd-1.217/socks.c:85: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(addr, res->ai_addr, res->ai_addrlen);
data/netcat-openbsd-1.217/socks.c:116: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 prompt[512];
data/netcat-openbsd-1.217/socks.c:184: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 buf[1024];
data/netcat-openbsd-1.217/socks.c:242: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(buf + 5, host, hlen);
data/netcat-openbsd-1.217/socks.c:243: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(buf + 5 + hlen, &serverport, sizeof serverport);
data/netcat-openbsd-1.217/socks.c:252: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(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
data/netcat-openbsd-1.217/socks.c:253: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(buf + 8, &in4->sin_port, sizeof in4->sin_port);
data/netcat-openbsd-1.217/socks.c:262: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(buf + 4, &in6->sin6_addr, sizeof in6->sin6_addr);
data/netcat-openbsd-1.217/socks.c:263: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(buf + 20, &in6->sin6_port,
data/netcat-openbsd-1.217/socks.c:304: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(buf + 2, &in4->sin_port, sizeof in4->sin_port);
data/netcat-openbsd-1.217/socks.c:305: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(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
data/netcat-openbsd-1.217/socks.c:346: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 proxypass[256];
data/netcat-openbsd-1.217/socks.c:347: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 resp[1024];
data/netcat-openbsd-1.217/atomicio.c:47:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	pfd.events = f == read ? POLLIN : POLLOUT;
data/netcat-openbsd-1.217/netcat.c:490: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).
			if (strlen(optarg) > 1 && optarg[0] == '0' &&
data/netcat-openbsd-1.217/netcat.c:1731:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		n = read(fd, buf + *bufpos, num);
data/netcat-openbsd-1.217/netcat.c:1965: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).
		sig.tcpm_keylen = TCP_MD5SIG_MAXKEYLEN < strlen(Sflag_password)
data/netcat-openbsd-1.217/netcat.c:1967: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).
			: strlen(Sflag_password);
data/netcat-openbsd-1.217/netcat.c:2111: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(s);
data/netcat-openbsd-1.217/netcat.c:2118: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(t->keyword) == len &&
data/netcat-openbsd-1.217/socks.c:98:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (atomicio(read, fd, buf + off, 1) != 1)
data/netcat-openbsd-1.217/socks.c:222:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		cnt = atomicio(read, proxyfd, buf, 2);
data/netcat-openbsd-1.217/socks.c:234:11:  [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).
			hlen = strlen(host);
data/netcat-openbsd-1.217/socks.c:275:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		cnt = atomicio(read, proxyfd, buf, 4);
data/netcat-openbsd-1.217/socks.c:284:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			cnt = atomicio(read, proxyfd, buf + 4, 6);
data/netcat-openbsd-1.217/socks.c:289:19:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			cnt = atomicio(read, proxyfd, buf + 4, 18);
data/netcat-openbsd-1.217/socks.c:313:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		cnt = atomicio(read, proxyfd, buf, 8);
data/netcat-openbsd-1.217/socks.c:324:38:  [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 (strcspn(host, "\r\n\t []:") != strlen(host))
data/netcat-openbsd-1.217/socks.c:339: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).
		r = strlen((char*)buf);
data/netcat-openbsd-1.217/socks.c:355:22:  [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).
			    b64_ntop(buf, strlen((char*)buf), resp,
data/netcat-openbsd-1.217/socks.c:362: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).
			r = strlen((char*)buf);

ANALYSIS SUMMARY:

Hits = 47
Lines analyzed = 2811 in approximately 0.08 seconds (33089 lines/second)
Physical Source Lines of Code (SLOC) = 2241
Hits@level = [0]  30 [1]  18 [2]  28 [3]   1 [4]   0 [5]   0
Hits@level+ = [0+]  77 [1+]  47 [2+]  29 [3+]   1 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 34.3597 [1+] 20.9728 [2+] 12.9407 [3+] 0.446229 [4+]   0 [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.