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/libpsl-0.21.0/fuzz/fuzzer.h
Examining data/libpsl-0.21.0/fuzz/libpsl_fuzzer.c
Examining data/libpsl-0.21.0/fuzz/libpsl_load_dafsa_fuzzer.c
Examining data/libpsl-0.21.0/fuzz/libpsl_load_fuzzer.c
Examining data/libpsl-0.21.0/fuzz/main.c
Examining data/libpsl-0.21.0/src/lookup_string_in_fixed_set.c
Examining data/libpsl-0.21.0/src/psl.c
Examining data/libpsl-0.21.0/tests/test-is-cookie-domain-acceptable.c
Examining data/libpsl-0.21.0/tests/test-is-public-all.c
Examining data/libpsl-0.21.0/tests/test-is-public-builtin.c
Examining data/libpsl-0.21.0/tests/test-is-public.c
Examining data/libpsl-0.21.0/tests/test-registrable-domain.c
Examining data/libpsl-0.21.0/tools/psl.c

FINAL RESULTS:

data/libpsl-0.21.0/fuzz/main.c:118:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/fuzz/main.c:125:2:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	snprintf(corporadir, corporadirsize, SRCDIR "/%s.in", target);
data/libpsl-0.21.0/fuzz/main.c:129:2:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	snprintf(corporadir, corporadirsize, SRCDIR "/%s.repro", target);
data/libpsl-0.21.0/tests/test-is-cookie-domain-acceptable.c:121:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/tests/test-is-public-all.c:235:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/tests/test-is-public-builtin.c:146:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/tests/test-is-public.c:200:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/tests/test-registrable-domain.c:209:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			return system(cmd) != 0;
data/libpsl-0.21.0/fuzz/main.c:111:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/tests/test-is-cookie-domain-acceptable.c:114:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/tests/test-is-public-all.c:228:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/tests/test-is-public-builtin.c:139:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/tests/test-is-public.c:193:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/tests/test-registrable-domain.c:202:26:  [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 *valgrind = getenv("TESTS_VALGRIND");
data/libpsl-0.21.0/fuzz/libpsl_fuzzer.c:59: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(domain, data, size);
data/libpsl-0.21.0/fuzz/libpsl_load_dafsa_fuzzer.c:51: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(in, ".DAFSA@PSL_0   \n", 16);
data/libpsl-0.21.0/fuzz/libpsl_load_dafsa_fuzzer.c:52: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(in + 16, data, size);
data/libpsl-0.21.0/fuzz/main.c:78:14:  [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).
			if ((fd = open(fname, O_RDONLY)) == -1) {
data/libpsl-0.21.0/fuzz/main.c:156: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[64 * 1024];
data/libpsl-0.21.0/src/lookup_string_in_fixed_set.c:18:14:  [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 const char multibyte_length_table[16] = {
data/libpsl-0.21.0/src/psl.c:125: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
data/libpsl-0.21.0/src/psl.c:251: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(elemp, elem, sizeof(psl_entry_t));
data/libpsl-0.21.0/src/psl.c:575: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(out + outlen, label, labellen);
data/libpsl-0.21.0/src/psl.c:586: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(out + outlen, "xn--", 4);
data/libpsl-0.21.0/src/psl.c:681: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 lookupname_buf[128] = "", *lookupname = lookupname_buf;
data/libpsl-0.21.0/src/psl.c:782: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 lookupname[128];
data/libpsl-0.21.0/src/psl.c:1157: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(fname, "rb"))) {
data/libpsl-0.21.0/src/psl.c:1182: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[256], *linep, *p;
data/libpsl-0.21.0/src/psl.c:1201: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).
		int version = atoi(buf + 11);
data/libpsl-0.21.0/src/psl.c:1209: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(psl->dafsa, buf, len);
data/libpsl-0.21.0/src/psl.c:1592:7:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
	if (!MultiByteToWideChar(CP_UTF8, 0, hostname, -1, wName, countof(wName)))
data/libpsl-0.21.0/src/psl.c:1806: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.
			static char buf[16];
data/libpsl-0.21.0/src/psl.c:1928:8:  [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.
	const char *psl_fname[3];
data/libpsl-0.21.0/tests/test-is-public-all.c:123: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(xdomain, "y.x", 3);
data/libpsl-0.21.0/tests/test-is-public-all.c:124: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(xdomain + 3, domain + 1, len);
data/libpsl-0.21.0/tests/test-is-public-all.c:141: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[256], *linep, *p;
data/libpsl-0.21.0/tests/test-is-public-all.c:161: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(PSL_FILE, "r"))) {
data/libpsl-0.21.0/tests/test-registrable-domain.c:105: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[256], domain[128], expected_regdom[128], semicolon[2];
data/libpsl-0.21.0/tests/test-registrable-domain.c:106: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 lbuf[258];
data/libpsl-0.21.0/tests/test-registrable-domain.c:156: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(PSL_TESTFILE, "r"))) {
data/libpsl-0.21.0/tools/psl.c:72: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 buf[64];
data/libpsl-0.21.0/tools/psl.c:171: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 buf[256], *domain, *lower;
data/libpsl-0.21.0/fuzz/main.c:74:16:  [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).
			fnamesize = strlen(dirname) + strlen(dp->d_name) + 2;
data/libpsl-0.21.0/fuzz/main.c:74:34:  [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).
			fnamesize = strlen(dirname) + strlen(dp->d_name) + 2;
data/libpsl-0.21.0/fuzz/main.c:90:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if ((n = read(fd, data, st.st_size)) == st.st_size) {
data/libpsl-0.21.0/fuzz/main.c:106:47:  [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 corporadirsize = sizeof(SRCDIR) + 1 + strlen(argv[0]) + 8;
data/libpsl-0.21.0/fuzz/main.c:114: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/fuzz/main.c:114:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/src/psl.c:567:41:  [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).
		labellen = e ? (size_t) (e - label) : strlen(label);
data/libpsl-0.21.0/src/psl.c:806:41:  [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 (suffix_init(&suffix, lookupname, strlen(lookupname)) == 0) {
data/libpsl-0.21.0/src/psl.c:858:20:  [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).
			suffix.length = strlen(punycode);
data/libpsl-0.21.0/src/psl.c:892:20:  [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).
			suffix.length = strlen(suffix.label);
data/libpsl-0.21.0/src/psl.c:934:20:  [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).
			suffix.length = strlen(suffix.label);
data/libpsl-0.21.0/src/psl.c:1059:20:  [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 (p = domain + strlen(domain) - 1; p >= domain; p--) {
data/libpsl-0.21.0/src/psl.c:1113:20:  [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 (p = domain + strlen(domain) - 1; p >= domain; p--) {
data/libpsl-0.21.0/src/psl.c:1196:13:  [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).
	is_dafsa = strlen(buf) == 16 && !strncmp(buf, ".DAFSA@PSL_", 11);
data/libpsl-0.21.0/src/psl.c:1647: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).
	cookie_domain_length = strlen(cookie_domain);
data/libpsl-0.21.0/src/psl.c:1648:20:  [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).
	hostname_length = strlen(hostname);
data/libpsl-0.21.0/src/psl.c:1660:30:  [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 (cookie_domain_length > strlen(p))
data/libpsl-0.21.0/src/psl.c:1734: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).
	size_t str_length = strlen(str);
data/libpsl-0.21.0/src/psl.c:1820: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).
				size_t tmp_len = strlen(str) + 1;
data/libpsl-0.21.0/tests/test-is-cookie-domain-acceptable.c:117: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-cookie-domain-acceptable.c:117:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public-all.c:120:16:  [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 len = strlen(domain);
data/libpsl-0.21.0/tests/test-is-public-all.c:231: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public-all.c:231:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public-builtin.c:142: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public-builtin.c:142:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public.c:196: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-is-public.c:196:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-registrable-domain.c:176:16:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
				} else if (sscanf(p, "%127s %127s", domain, expected_regdom) == 2) {
data/libpsl-0.21.0/tests/test-registrable-domain.c:205: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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tests/test-registrable-domain.c:205:40:  [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 cmdsize = strlen(valgrind) + strlen(argv[0]) + 32;
data/libpsl-0.21.0/tools/psl.c:179:16:  [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 (len = strlen(domain); len && isspace(domain[len - 1]); len--); /* skip trailing spaces */

ANALYSIS SUMMARY:

Hits = 74
Lines analyzed = 3973 in approximately 0.35 seconds (11468 lines/second)
Physical Source Lines of Code (SLOC) = 2426
Hits@level = [0] 121 [1]  32 [2]  28 [3]   6 [4]   8 [5]   0
Hits@level+ = [0+] 195 [1+]  74 [2+]  42 [3+]  14 [4+]   8 [5+]   0
Hits/KSLOC@level+ = [0+] 80.3792 [1+] 30.5029 [2+] 17.3124 [3+] 5.77082 [4+] 3.29761 [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.