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/tcpspy-1.7d/log.c
Examining data/tcpspy-1.7d/log.h
Examining data/tcpspy-1.7d/rcsid.h
Examining data/tcpspy-1.7d/rule.c
Examining data/tcpspy-1.7d/rule.h
Examining data/tcpspy-1.7d/tcpspy.c

FINAL RESULTS:

data/tcpspy-1.7d/tcpspy.c:380:10:  [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 (lnkbuf, lnktgt, sizeof (lnktgt) - 1);
data/tcpspy-1.7d/tcpspy.c:391:10:  [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 (exebuf, exetgt, sizeof (exetgt) - 1);
data/tcpspy-1.7d/log.c:182:4:  [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 (fp, fmt, ap);
data/tcpspy-1.7d/tcpspy.c:542: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, "dpe:I:U:G:u:w:i:f:F:")) != -1) {
data/tcpspy-1.7d/log.c:155: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 timebuf[100];
data/tcpspy-1.7d/tcpspy.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 exe[PATH_MAX];
data/tcpspy-1.7d/tcpspy.c:190: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 (newc, c, sizeof (conn_t));
data/tcpspy-1.7d/tcpspy.c:236: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[1024];
data/tcpspy-1.7d/tcpspy.c:242: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).
		fp = fopen ("/proc/net/tcp", "r");
data/tcpspy-1.7d/tcpspy.c:248: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).
		fp6 = fopen ("/proc/net/tcp6", "r");
data/tcpspy-1.7d/tcpspy.c:349: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 fdbuf[PATH_MAX];
data/tcpspy-1.7d/tcpspy.c:372: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 lnkbuf[PATH_MAX], lnktgt[PATH_MAX];
data/tcpspy-1.7d/tcpspy.c:373: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 exebuf[PATH_MAX], exetgt[PATH_MAX];
data/tcpspy-1.7d/tcpspy.c:412: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 laddr[INET6_ADDRSTRLEN], raddr[INET6_ADDRSTRLEN]; /* space reserved for numeric IPv6 */
data/tcpspy-1.7d/tcpspy.c:414: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 uidbuf[32];
data/tcpspy-1.7d/tcpspy.c:417: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 lport[64], rport[64];
data/tcpspy-1.7d/tcpspy.c:568:15:  [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).
				if ((fp = fopen (optarg, "r")) == NULL) {
data/tcpspy-1.7d/tcpspy.c:579: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).
				interval = atoi (optarg);
data/tcpspy-1.7d/tcpspy.c:590:17:  [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).
					dropuser = atoi (optarg);
data/tcpspy-1.7d/tcpspy.c:591:21:  [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).
					pw = getpwuid (atoi (optarg));
data/tcpspy-1.7d/tcpspy.c:613:18:  [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).
					dropgroup = atoi (optarg);
data/tcpspy-1.7d/tcpspy.c:706:12:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
		nullfd = open (_PATH_DEVNULL, O_RDWR, 0);
data/tcpspy-1.7d/tcpspy.c:756: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 (&old, &new, sizeof (conntable_t));
data/tcpspy-1.7d/tcpspy.c:396:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy (buf, exetgt, bufsize);
data/tcpspy-1.7d/tcpspy.c:438:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy (lport, se->s_name, sizeof (lport));
data/tcpspy-1.7d/tcpspy.c:442:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy (rport, se->s_name, sizeof (rport));
data/tcpspy-1.7d/tcpspy.c:562: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).
				memset (optarg, '\0', strlen (optarg));
data/tcpspy-1.7d/tcpspy.c:723:3:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
		umask (0);
data/tcpspy-1.7d/tcpspy.c:771: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 (interval * 1000);

ANALYSIS SUMMARY:

Hits = 29
Lines analyzed = 1811 in approximately 0.09 seconds (21153 lines/second)
Physical Source Lines of Code (SLOC) = 1026
Hits@level = [0]  28 [1]   6 [2]  19 [3]   1 [4]   1 [5]   2
Hits@level+ = [0+]  57 [1+]  29 [2+]  23 [3+]   4 [4+]   3 [5+]   2
Hits/KSLOC@level+ = [0+] 55.5556 [1+] 28.2651 [2+] 22.4172 [3+] 3.89864 [4+] 2.92398 [5+] 1.94932
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.