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/sockstat-0.4.1/sockstat.c

FINAL RESULTS:

data/sockstat-0.4.1/sockstat.c:231:6:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	if (sscanf(buf, "Name: %s\n", ret) != 1)
data/sockstat-0.4.1/sockstat.c:440:11:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
				count=sscanf(buf, "%*x: %u %u %u %u %hx %lu %s",
data/sockstat-0.4.1/sockstat.c:526: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, "46clp:G:U:P:hR:u")) != EOF)
data/sockstat-0.4.1/sockstat.c:82: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[1024];
data/sockstat-0.4.1/sockstat.c:102: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 buf[1024], o_pname[8];
data/sockstat-0.4.1/sockstat.c:220: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 ret[1024];
data/sockstat-0.4.1/sockstat.c:225: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).
	if ((fp = fopen(buf, "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:261: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/sockstat-0.4.1/sockstat.c:278: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/sockstat-0.4.1/sockstat.c:295: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/sockstat-0.4.1/sockstat.c:371: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 *path[1024];
data/sockstat-0.4.1/sockstat.c:555: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).
				  o_gid = atoi(optarg);
data/sockstat-0.4.1/sockstat.c:558:14:  [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).
			  o_uid = atoi(optarg);
data/sockstat-0.4.1/sockstat.c:574: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).
				  o_uid = atoi(optarg);
data/sockstat-0.4.1/sockstat.c:583:13:  [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 ((tcp = fopen("/proc/net/tcp", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:586:13:  [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 ((udp = fopen("/proc/net/udp", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:589:13:  [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 ((raw = fopen("/proc/net/raw", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:592:14:  [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 ((tcp6 = fopen("/proc/net/tcp6", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:595:14:  [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 ((udp6 = fopen("/proc/net/udp6", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:598:14:  [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 ((raw6 = fopen("/proc/net/raw6", "r")) == NULL)
data/sockstat-0.4.1/sockstat.c:601: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 ((funix = fopen("/proc/net/unix", "r")) == NULL) {
data/sockstat-0.4.1/sockstat.c:655: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).
				pid_t pid = atoi(procent->d_name);
data/sockstat-0.4.1/sockstat.c:701:19:  [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).
					if (o_pid == atoi(procent->d_name))
data/sockstat-0.4.1/sockstat.c:562: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).
			  for (i = 0; i < strlen(optarg); ++i)
data/sockstat-0.4.1/sockstat.c:566:8:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
					  strncpy(o_pname, optarg, sizeof(o_pname));
data/sockstat-0.4.1/sockstat.c:706:37:  [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 (!strncasecmp(pn, o_pname, strlen(o_pname)))

ANALYSIS SUMMARY:

Hits = 26
Lines analyzed = 744 in approximately 0.03 seconds (24286 lines/second)
Physical Source Lines of Code (SLOC) = 608
Hits@level = [0]  16 [1]   3 [2]  20 [3]   1 [4]   2 [5]   0
Hits@level+ = [0+]  42 [1+]  26 [2+]  23 [3+]   3 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 69.0789 [1+] 42.7632 [2+] 37.8289 [3+] 4.93421 [4+] 3.28947 [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.