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/cruft-ng-0.4.8/cruft.cc
Examining data/cruft-ng-0.4.8/dpkg.h
Examining data/cruft-ng-0.4.8/dpkg_exclude.cc
Examining data/cruft-ng-0.4.8/dpkg_exclude.h
Examining data/cruft-ng-0.4.8/dpkg_lib.cc
Examining data/cruft-ng-0.4.8/dpkg_popen.cc
Examining data/cruft-ng-0.4.8/explain.cc
Examining data/cruft-ng-0.4.8/explain.h
Examining data/cruft-ng-0.4.8/filters.cc
Examining data/cruft-ng-0.4.8/filters.h
Examining data/cruft-ng-0.4.8/mlocate.cc
Examining data/cruft-ng-0.4.8/mlocate.h
Examining data/cruft-ng-0.4.8/shellexp.c
Examining data/cruft-ng-0.4.8/test_diversions.cc
Examining data/cruft-ng-0.4.8/test_dpkg.cc
Examining data/cruft-ng-0.4.8/test_excludes.cc
Examining data/cruft-ng-0.4.8/test_explain.cc
Examining data/cruft-ng-0.4.8/test_filters.cc
Examining data/cruft-ng-0.4.8/test_mlocate.cc
Examining data/cruft-ng-0.4.8/usr_merge.cc
Examining data/cruft-ng-0.4.8/usr_merge.h

FINAL RESULTS:

data/cruft-ng-0.4.8/cruft.cc:73:6:  [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.
	if (system("updatedb")) {
data/cruft-ng-0.4.8/dpkg_popen.cc:17:12:  [4] (shell) popen:
  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.
	if ((fp = popen("dpkg-query --show --showformat '${binary:Package}\n'", "r")) == NULL) return 1;
data/cruft-ng-0.4.8/dpkg_popen.cc:39:12:  [4] (shell) popen:
  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.
	if ((fp = popen("dpkg-divert --list", "r")) == NULL) return 1;
data/cruft-ng-0.4.8/dpkg_popen.cc:91:12:  [4] (shell) popen:
  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.
	if ((fp = popen(command.c_str(), "r")) == NULL) return 1;
data/cruft-ng-0.4.8/explain.cc:15:12:  [4] (shell) popen:
  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.
	if ((fp = popen((script + " 3>&1").c_str(), "r")) == NULL) return;
data/cruft-ng-0.4.8/cruft.cc:81:15:  [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 debug = getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/cruft.cc:171:13:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
	char* file=realpath(infile.c_str(), NULL);
data/cruft-ng-0.4.8/cruft.cc:202:15:  [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 debug = getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/dpkg_popen.cc:12:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/dpkg_popen.cc:35:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/dpkg_popen.cc:79:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/explain.cc:31:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/filters.cc:13:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/filters.cc:32:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/mlocate.cc:11:13:  [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 debug=getenv("DEBUG") != NULL;
data/cruft-ng-0.4.8/cruft.cc:102: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 param1[256];
data/cruft-ng-0.4.8/cruft.cc:105: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 param2[256];
data/cruft-ng-0.4.8/cruft.cc:229: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[SIZEBUF];
data/cruft-ng-0.4.8/dpkg_popen.cc:19: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[SIZEBUF];
data/cruft-ng-0.4.8/dpkg_popen.cc:42: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[SIZEBUF];
data/cruft-ng-0.4.8/dpkg_popen.cc:89: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[SIZEBUF];
data/cruft-ng-0.4.8/explain.cc:17: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[SIZEBUF];
data/cruft-ng-0.4.8/cruft.cc:103:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(param1,file.c_str(),sizeof(param1));
data/cruft-ng-0.4.8/cruft.cc:106:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(param2,glob.c_str(),sizeof(param2));
data/cruft-ng-0.4.8/mlocate.cc:24:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	mlocate.read ((char *) &header,sizeof(db_header));
data/cruft-ng-0.4.8/mlocate.cc:64:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		mlocate.read (dir,sizeof(db_directory));

ANALYSIS SUMMARY:

Hits = 26
Lines analyzed = 1123 in approximately 0.07 seconds (16445 lines/second)
Physical Source Lines of Code (SLOC) = 921
Hits@level = [0]   2 [1]   4 [2]   7 [3]  10 [4]   5 [5]   0
Hits@level+ = [0+]  28 [1+]  26 [2+]  22 [3+]  15 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 30.4017 [1+] 28.2302 [2+] 23.8871 [3+] 16.2866 [4+] 5.42888 [5+]   0
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.