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/swaylock-1.5/background-image.c
Examining data/swaylock-1.5/cairo.c
Examining data/swaylock-1.5/comm.c
Examining data/swaylock-1.5/include/background-image.h
Examining data/swaylock-1.5/include/cairo.h
Examining data/swaylock-1.5/include/comm.h
Examining data/swaylock-1.5/include/log.h
Examining data/swaylock-1.5/include/loop.h
Examining data/swaylock-1.5/include/pool-buffer.h
Examining data/swaylock-1.5/include/seat.h
Examining data/swaylock-1.5/include/swaylock.h
Examining data/swaylock-1.5/include/unicode.h
Examining data/swaylock-1.5/log.c
Examining data/swaylock-1.5/loop.c
Examining data/swaylock-1.5/main.c
Examining data/swaylock-1.5/pam.c
Examining data/swaylock-1.5/password.c
Examining data/swaylock-1.5/pool-buffer.c
Examining data/swaylock-1.5/render.c
Examining data/swaylock-1.5/seat.c
Examining data/swaylock-1.5/shadow.c
Examining data/swaylock-1.5/unicode.c

FINAL RESULTS:

data/swaylock-1.5/include/log.h:19:58:  [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 _ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
data/swaylock-1.5/log.c:51:2:  [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(stderr, fmt, args);
data/swaylock-1.5/main.c:388:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
		strcpy(res + len, argv[i]);
data/swaylock-1.5/main.c:1002:17:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	return path && access(path, R_OK) != -1;
data/swaylock-1.5/main.c:1064:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(flag, "--%s", line);
data/swaylock-1.5/shadow.c:83:13:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
		char *c = crypt(buf, encpw);
data/swaylock-1.5/main.c:723:7:  [3] (buffer) getopt_long:
  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.
		c = getopt_long(argc, argv, "c:deFfhi:kKLlnrs:tuvC:", long_options,
data/swaylock-1.5/main.c:1012:22:  [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 *config_home = getenv("XDG_CONFIG_HOME");
data/swaylock-1.5/main.c:1100:2:  [3] (random) srand:
  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.
	srand(time(NULL));
data/swaylock-1.5/pool-buffer.c:28:21:  [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 *path = getenv("XDG_RUNTIME_DIR");
data/swaylock-1.5/include/swaylock.h:70: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 buffer[1024];
data/swaylock-1.5/log.c:38: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 buffer[26];
data/swaylock-1.5/main.c:69:17:  [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).
		int devnull = open("/dev/null", O_RDWR);
data/swaylock-1.5/main.c:837:29:  [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).
				state->args.font_size = atoi(optarg);
data/swaylock-1.5/main.c:858:40:  [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).
				state->args.indicator_x_position = atoi(optarg);
data/swaylock-1.5/main.c:864:40:  [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).
				state->args.indicator_y_position = atoi(optarg);
data/swaylock-1.5/main.c:1035: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).
	FILE *config = fopen(path, "r");
data/swaylock-1.5/pam.c:66:10:  [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 msg[64];
data/swaylock-1.5/pool-buffer.c:42:11:  [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).
	int fd = mkstemp(*name);
data/swaylock-1.5/render.c:149: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 attempts[4]; // like i3lock: count no more than 999
data/swaylock-1.5/comm.c:14:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	amt = read(comm[0][0], &size, sizeof(size));
data/swaylock-1.5/comm.c:29:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		amt = read(comm[0][0], &buf[offs], size - offs);
data/swaylock-1.5/comm.c:100:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(comm[1][0], &result, sizeof(result)) != sizeof(result)) {
data/swaylock-1.5/main.c:35:12:  [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 len = strlen(color);
data/swaylock-1.5/main.c:42: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(color) == 6) {
data/swaylock-1.5/main.c:86:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (read(fds[0], &success, 1) != 1 || !success) {
data/swaylock-1.5/main.c:383: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(argv[i]) + 1;
data/swaylock-1.5/main.c:389: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(argv[i]);
data/swaylock-1.5/main.c:434: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).
		image->path = realloc(image->path, strlen(image->path) + 2);
data/swaylock-1.5/main.c:436:25:  [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).
		memmove(ptr + 1, ptr, strlen(ptr) + 1);
data/swaylock-1.5/pool-buffer.c:34: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).
	size_t name_size = strlen(template) + 1 + strlen(path) + 1;
data/swaylock-1.5/pool-buffer.c:34: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).
	size_t name_size = strlen(template) + 1 + strlen(path) + 1;
data/swaylock-1.5/shadow.c:104: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).
	clear_buffer(encpw, strlen(encpw));

ANALYSIS SUMMARY:

Hits = 33
Lines analyzed = 3338 in approximately 0.09 seconds (38471 lines/second)
Physical Source Lines of Code (SLOC) = 2882
Hits@level = [0]  11 [1]  13 [2]  10 [3]   4 [4]   6 [5]   0
Hits@level+ = [0+]  44 [1+]  33 [2+]  20 [3+]  10 [4+]   6 [5+]   0
Hits/KSLOC@level+ = [0+] 15.2672 [1+] 11.4504 [2+] 6.93963 [3+] 3.46981 [4+] 2.08189 [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.