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/restorecond-3.1/restore.c
Examining data/restorecond-3.1/restore.h
Examining data/restorecond-3.1/restorecond.c
Examining data/restorecond-3.1/restorecond.h
Examining data/restorecond-3.1/stringslist.c
Examining data/restorecond-3.1/stringslist.h
Examining data/restorecond-3.1/user.c
Examining data/restorecond-3.1/utmpwatcher.c
Examining data/restorecond-3.1/utmpwatcher.h
Examining data/restorecond-3.1/watch.c

FINAL RESULTS:

data/restorecond-3.1/restorecond.c:168:16:  [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 ((opt = getopt(argc, argv, "hdf:uv")) > 0) {
data/restorecond-3.1/restorecond.c:92: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 val[16];
data/restorecond-3.1/restorecond.c:100:10:  [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).
	pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644);
data/restorecond-3.1/user.c:120: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 buffer[BUF_LEN+1];
data/restorecond-3.1/user.c:222:18:  [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).
	local_lock_fd = open(ptr, O_CREAT | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, S_IRUSR | S_IWUSR);
data/restorecond-3.1/utmpwatcher.c:58: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).
	FILE *cfg = fopen(utmp_path, "r");
data/restorecond-3.1/watch.c:180: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[BUF_LEN];
data/restorecond-3.1/watch.c:274: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).
	cfg = fopen(watch_file_path, "r");
data/restorecond-3.1/restore.c:83: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(globbuf.gl_pathv[i]) - 2;
data/restorecond-3.1/watch.c:67: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(globbuf.gl_pathv[i]) - 2;
data/restorecond-3.1/watch.c:184:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	len = read(fd, buf, BUF_LEN);
data/restorecond-3.1/watch.c:237: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).
		int l = strlen(buffer) - 1;

ANALYSIS SUMMARY:

Hits = 12
Lines analyzed = 1378 in approximately 0.05 seconds (29828 lines/second)
Physical Source Lines of Code (SLOC) = 955
Hits@level = [0]  24 [1]   4 [2]   7 [3]   1 [4]   0 [5]   0
Hits@level+ = [0+]  36 [1+]  12 [2+]   8 [3+]   1 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 37.6963 [1+] 12.5654 [2+] 8.37696 [3+] 1.04712 [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.