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/metabat-2.15/src/BamUtils.h
Examining data/metabat-2.15/src/CheckRead.hpp
Examining data/metabat-2.15/src/IOThreadBuffer.h
Examining data/metabat-2.15/src/KseqReader.h
Examining data/metabat-2.15/src/OpenMP.h
Examining data/metabat-2.15/src/ProgressTracker.h
Examining data/metabat-2.15/src/RunningStats.h
Examining data/metabat-2.15/src/SafeOfstream.hpp
Examining data/metabat-2.15/src/contigOverlaps.cpp
Examining data/metabat-2.15/src/igraph.h
Examining data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp
Examining data/metabat-2.15/src/jgi_summarize_bam_contig_depths.h
Examining data/metabat-2.15/src/kseq.h
Examining data/metabat-2.15/src/metabat1.cpp
Examining data/metabat-2.15/src/metabat1.h
Examining data/metabat-2.15/src/metabat2.cpp
Examining data/metabat-2.15/src/metabat2.h
Examining data/metabat-2.15/src/ranker.h
Examining data/metabat-2.15/src/tile.h

FINAL RESULTS:

data/metabat-2.15/src/metabat1.h:254: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(stdout, format, argptr);
data/metabat-2.15/src/metabat1.h:266:3:  [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(stdout, format, argptr);
data/metabat-2.15/src/metabat2.h:208: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(stdout, format, argptr);
data/metabat-2.15/src/metabat2.h:220:3:  [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(stdout, format, argptr);
data/metabat-2.15/src/contigOverlaps.cpp:131: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, "h",
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:213: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, "h",
data/metabat-2.15/src/metabat1.cpp:74: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(seed);
data/metabat-2.15/src/metabat1.cpp:1822:20:  [3] (random) setstate:
  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.
                is.setstate(std::ios::eofbit);
data/metabat-2.15/src/metabat2.cpp:55: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(seed);
data/metabat-2.15/src/metabat2.cpp:1114:8:  [3] (random) setstate:
  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.
				is.setstate(std::ios::eofbit);
data/metabat-2.15/src/BamUtils.h:145:4:  [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).
			open(loadIdx);
data/metabat-2.15/src/BamUtils.h:197:7:  [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).
	void open(bool loadIdx) {
data/metabat-2.15/src/ProgressTracker.h:48:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
		sprintf(msg, "%0.1f%% (%ld of %ld), ETA %ld:%02ld:%02ld    ", 100.0 * fraction, _point, _size, secondsLeft / 3600, (secondsLeft % 3600) / 60,
data/metabat-2.15/src/ProgressTracker.h:58: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 msg[80]; // 80 chars should fit easily: "100.0% (verylargenumber of verylargenumber) xxxxx.yy min"
data/metabat-2.15/src/contigOverlaps.cpp:142:23:  [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).
				percentIdentity = atoi(optarg) / 100.0;
data/metabat-2.15/src/contigOverlaps.cpp:312: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 nomatch[2] = "*";
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:223:23:  [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).
				percentIdentity = atoi(optarg) / 100.0;
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:235:16:  [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).
				gcWindow = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:250:19:  [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).
				shredLength = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:253:18:  [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).
				shredDepth = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:256:23:  [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).
				minContigLength = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:259:18:  [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).
				minMapQual = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:277:20:  [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).
				maxEdgeBases = atoi(optarg);
data/metabat-2.15/src/jgi_summarize_bam_contig_depths.cpp:748:7:  [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).
			of.open( outputTableFile.c_str() );
data/metabat-2.15/src/kseq.h:130: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(str->s + str->l, ks->buf + ks->begin, i - ks->begin);  \
data/metabat-2.15/src/metabat1.cpp:445:5:  [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 tn[5] = {'\0'};
data/metabat-2.15/src/metabat1.cpp:1754:10:  [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).
	pFile = fopen(f, "r");
data/metabat-2.15/src/metabat1.h:130: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.
static char os_buffer[buf_size];
data/metabat-2.15/src/metabat1.h:482:6:  [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).
	i = atoi(line);
data/metabat-2.15/src/metabat1.h:530:18:  [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* file = fopen("/proc/meminfo", "r");
data/metabat-2.15/src/metabat1.h:532: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 line[128];
data/metabat-2.15/src/metabat2.cpp:114: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 tnfSeq[5] = {0,0,0,0,0};
data/metabat-2.15/src/metabat2.cpp:123:6:  [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 tn[5] = {0,0,0,0,0};
data/metabat-2.15/src/metabat2.cpp:124:6:  [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(tn, tnfSeq, 4);
data/metabat-2.15/src/metabat2.cpp:498: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 tn[5] = { '\0' };
data/metabat-2.15/src/metabat2.cpp:1048:10:  [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).
	pFile = fopen(f, "r");
data/metabat-2.15/src/metabat2.h:101: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.
static char os_buffer[buf_size];
data/metabat-2.15/src/metabat2.h:319:6:  [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).
	i = atoi(line);
data/metabat-2.15/src/metabat2.h:348:15:  [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* file = fopen("/proc/meminfo", "r");
data/metabat-2.15/src/metabat2.h:350: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 line[128];
data/metabat-2.15/src/tile.h:46:6:  [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).
	p = fopen(cs, "r");
data/metabat-2.15/src/metabat1.h:478: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).
	int i = strlen(line);
data/metabat-2.15/src/metabat2.h:315: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).
	int i = strlen(line);

ANALYSIS SUMMARY:

Hits = 43
Lines analyzed = 8868 in approximately 0.27 seconds (32765 lines/second)
Physical Source Lines of Code (SLOC) = 7247
Hits@level = [0]  15 [1]   2 [2]  31 [3]   6 [4]   4 [5]   0
Hits@level+ = [0+]  58 [1+]  43 [2+]  41 [3+]  10 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 8.00331 [1+] 5.93349 [2+] 5.65751 [3+] 1.37988 [4+] 0.551953 [5+]   0
Dot directories skipped = 3 (--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.