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/pdfgrep-2.1.2/src/regengine.cc
Examining data/pdfgrep-2.1.2/src/intervals.cc
Examining data/pdfgrep-2.1.2/src/pdfgrep.cc
Examining data/pdfgrep-2.1.2/src/exclude.h
Examining data/pdfgrep-2.1.2/src/search.cc
Examining data/pdfgrep-2.1.2/src/output.cc
Examining data/pdfgrep-2.1.2/src/output.h
Examining data/pdfgrep-2.1.2/src/cache.h
Examining data/pdfgrep-2.1.2/src/pdfgrep.h
Examining data/pdfgrep-2.1.2/src/intervals.h
Examining data/pdfgrep-2.1.2/src/regengine.h
Examining data/pdfgrep-2.1.2/src/exclude.cc
Examining data/pdfgrep-2.1.2/src/search.h
Examining data/pdfgrep-2.1.2/src/cache.cc

FINAL RESULTS:

data/pdfgrep-2.1.2/src/cache.cc:131:27:  [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 *cache_base = getenv("XDG_CACHE_HOME");
data/pdfgrep-2.1.2/src/cache.cc:137:16:  [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 *home = getenv("HOME");
data/pdfgrep-2.1.2/src/pdfgrep.cc:170:7:  [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.
	if (!getenv(env_var)) {
data/pdfgrep-2.1.2/src/pdfgrep.cc:173:29:  [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* colors_list = strdup(getenv(env_var));
data/pdfgrep-2.1.2/src/pdfgrep.cc:487:11:  [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.
		int c = getopt_long(argc, argv, "icA:B:C:nrRhHVPpqm:FoZe:f:lL",
data/pdfgrep-2.1.2/src/pdfgrep.cc:727:44:  [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.
	bool color_tty = isatty(STDOUT_FILENO) && getenv("TERM") &&
data/pdfgrep-2.1.2/src/pdfgrep.cc:728:10:  [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.
		strcmp(getenv("TERM"), "dumb");
data/pdfgrep-2.1.2/src/pdfgrep.cc:770: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.
			char *limitstr = getenv("PDFGREP_CACHE_LIMIT");
data/pdfgrep-2.1.2/src/pdfgrep.cc:311:12:  [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 sha1sum[20];
data/pdfgrep-2.1.2/src/regengine.cc:74: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 err_msg[256];
data/pdfgrep-2.1.2/src/pdfgrep.cc:179:24:  [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 colors_list_len = strlen(colors_list);
data/pdfgrep-2.1.2/src/pdfgrep.cc:186:8:  [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).
		i += strlen(cur_color_pair); /* skip token content */

ANALYSIS SUMMARY:

Hits = 12
Lines analyzed = 2376 in approximately 0.08 seconds (29808 lines/second)
Physical Source Lines of Code (SLOC) = 1535
Hits@level = [0]   0 [1]   2 [2]   2 [3]   8 [4]   0 [5]   0
Hits@level+ = [0+]  12 [1+]  12 [2+]  10 [3+]   8 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 7.81759 [1+] 7.81759 [2+] 6.51466 [3+] 5.21173 [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.