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/libssw-1.1/src/example.c
Examining data/libssw-1.1/src/example.cpp
Examining data/libssw-1.1/src/kseq.h
Examining data/libssw-1.1/src/ssw_cpp.cpp
Examining data/libssw-1.1/src/ssw_cpp.h
Examining data/libssw-1.1/src/ssw.c
Examining data/libssw-1.1/src/ssw.h
Examining data/libssw-1.1/src/main.c
Examining data/libssw-1.1/src/sswjni.c
Examining data/libssw-1.1/debian/include/simde/check.h
Examining data/libssw-1.1/debian/include/simde/debug-trap.h
Examining data/libssw-1.1/debian/include/simde/hedley.h
Examining data/libssw-1.1/debian/include/simde/simde-arch.h
Examining data/libssw-1.1/debian/include/simde/simde-common.h
Examining data/libssw-1.1/debian/include/simde/x86/mmx.h
Examining data/libssw-1.1/debian/include/simde/x86/sse.h
Examining data/libssw-1.1/debian/include/simde/x86/sse2.h

FINAL RESULTS:

data/libssw-1.1/debian/include/simde/check.h:60:40:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#    define simde_errorf(format, ...) (fprintf(stderr, format, __VA_ARGS__), abort())
data/libssw-1.1/debian/include/simde/hedley.h:1207:79:  [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 HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))
data/libssw-1.1/src/main.c:288:14:  [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).
			case 'a': strcpy(mat_name, optarg); break;
data/libssw-1.1/src/main.c:282:14:  [3] (buffer) getopt:
  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.
	while ((l = getopt(argc, argv, "m:x:o:e:a:f:pcrsh")) >= 0) {
data/libssw-1.1/debian/include/simde/hedley.h:1679:25:  [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.
             ((struct { char v[sizeof(void) * 2]; } *) 1) \
data/libssw-1.1/debian/include/simde/simde-common.h:499:44:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
#        define simde_memcpy(dest, src, n) memcpy(dest, src, n)
data/libssw-1.1/debian/include/simde/simde-common.h:513:42:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
#      define simde_memcpy(dest, src, n) memcpy(dest, src, n)
data/libssw-1.1/src/example.c:108:15:  [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 ref_seq[40] = {'C', 'A', 'G', 'C', 'C', 'T', 'T', 'T', 'C', 'T', 'G', 'A', 'C', 'C', 'C', 'G', 'G', 'A', 'A', 'A', 'T',
data/libssw-1.1/src/example.c:110:15:  [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 read_seq[16] = {'C', 'T', 'G', 'A', 'G', 'C', 'C', 'G', 'G', 'T', 'A', 'A', 'A', 'T', 'C', '\0'};	// read sequence
data/libssw-1.1/src/kseq.h:123: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/libssw-1.1/src/main.c:221: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 mat_name[16];
data/libssw-1.1/src/main.c:284:22:  [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).
			case 'm': match = atoi(optarg); break;
data/libssw-1.1/src/main.c:285:25:  [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).
			case 'x': mismatch = atoi(optarg); break;
data/libssw-1.1/src/main.c:286:25:  [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).
			case 'o': gap_open = atoi(optarg); break;
data/libssw-1.1/src/main.c:287:30:  [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).
			case 'e': gap_extension = atoi(optarg); break;
data/libssw-1.1/src/main.c:289: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).
			case 'f': filter = atoi(optarg); break;
data/libssw-1.1/src/main.c:329: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 *f_mat = fopen(mat_name, "r");
data/libssw-1.1/src/main.c:330: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 line[128];
data/libssw-1.1/src/main.c:337: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 str[4], *s = str;
data/libssw-1.1/src/main.c:344:27:  [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).
						mata[k++] = (int8_t)atoi(str);
data/libssw-1.1/src/main.c:352:26:  [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).
					mata[k++] = (int8_t)atoi(str);
data/libssw-1.1/src/ssw_cpp.cpp:275: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(score_matrix_, score_matrix, sizeof(int8_t) * score_matrix_size_ * score_matrix_size_);
data/libssw-1.1/src/ssw_cpp.cpp:277: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(translation_matrix_, translation_matrix, sizeof(int8_t) * translation_matrix_size);
data/libssw-1.1/src/ssw_cpp.cpp:454: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(score_matrix_, score_matrix, sizeof(int8_t) * score_matrix_size_ * score_matrix_size_);
data/libssw-1.1/src/ssw_cpp.cpp:456: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(translation_matrix_, translation_matrix, sizeof(int8_t) * translation_matrix_size);
data/libssw-1.1/src/ssw_cpp.cpp:466: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(translation_matrix_, kBaseTranslation, sizeof(int8_t) * SizeOfArray(kBaseTranslation));
data/libssw-1.1/src/sswjni.c:14:23:  [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.
			int charsPrinted = sprintf(currentBufferPosition, "%d%c", cigar_int_to_len(align->cigar[i]), cigar_int_to_op(align->cigar[i]));
data/libssw-1.1/src/example.c:137:57:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
		for (m = 0; m < 4; ++m) mat[k++] = l == m ? match : - mismatch;	/* weight_match : -weight_mismatch */
data/libssw-1.1/src/main.c:36: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).
	int32_t end = strlen(seq), start = 0;
data/libssw-1.1/src/main.c:60:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			const kseq_t* read,
data/libssw-1.1/src/main.c:66:10:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
	int32_t mismatch;
data/libssw-1.1/src/main.c:317:65:  [1] (buffer) mismatch:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
		for (m = 0; LIKELY(m < 4); ++m) mata[k++] = l == m ? match : -mismatch;	/* weight_match : -weight_mismatch */
data/libssw-1.1/src/ssw.c:71:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int32_t read;    //alignment ending position on read, 0-based
data/libssw-1.1/src/ssw.c:82:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	const int8_t* read;
data/libssw-1.1/src/ssw.c:565:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				 const int8_t* read,
data/libssw-1.1/src/ssw.c:636:39:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				temp2 = h_b[d] + mat[ref[j] * n + read[i]];
data/libssw-1.1/src/ssw.c:765:36:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
s_profile* ssw_init (const int8_t* read, const int32_t readLen, const int8_t* mat, const int32_t n, const int8_t score_size) {
data/libssw-1.1/src/ssw.c:778:30:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		p->profile_byte = qP_byte (read, mat, readLen, n, bias);
data/libssw-1.1/src/ssw.c:780:69:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (score_size == 1 || score_size == 2) p->profile_word = qP_word (read, mat, readLen, n);
data/libssw-1.1/src/ssw.c:781:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	p->read = read;
data/libssw-1.1/src/ssw.c:840:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	r->read_end1 = bests[0].read;
data/libssw-1.1/src/ssw.c:852:35:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read_reverse = seq_reverse(prof->read, r->read_end1);
data/libssw-1.1/src/ssw.c:863:51:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	r->read_begin1 = r->read_end1 - bests_reverse[0].read;
data/libssw-1.1/src/ssw.c:930:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					   const char* read,
data/libssw-1.1/src/ssw.c:947:65:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				fprintf(stderr, "ref[%d]: %c\tread[%d]: %c\n", j, *ref, j, *read);
data/libssw-1.1/src/ssw.c:948:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				if (*ref != *read) {
data/libssw-1.1/src/ssw.c:960:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				++ read;
data/libssw-1.1/src/ssw.h:76:36:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
s_profile* ssw_init (const int8_t* read, const int32_t readLen, const int8_t* mat, const int32_t n, const int8_t score_size);
data/libssw-1.1/src/ssw.h:151:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					   const char* read,
data/libssw-1.1/src/ssw_cpp.cpp:331:19:  [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 query_len = strlen(query);
data/libssw-1.1/src/ssw_cpp.cpp:366:19:  [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 query_len = strlen(query);
data/libssw-1.1/src/sswjni.c:38:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		jbyteArray read, jbyteArray matrix, jint matrixSize, jint score_size,
data/libssw-1.1/src/sswjni.c:46:53:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	jbyte* readPtr = (*env)->GetByteArrayElements(env, read, NULL);
data/libssw-1.1/src/sswjni.c:47:46:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	jsize readLen = (*env)->GetArrayLength(env, read);
data/libssw-1.1/src/sswjni.c:57:40:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	(*env)->ReleaseByteArrayElements(env, read, readPtr, JNI_ABORT);

ANALYSIS SUMMARY:

Hits = 55
Lines analyzed = 17590 in approximately 0.47 seconds (37445 lines/second)
Physical Source Lines of Code (SLOC) = 15027
Hits@level = [0]  79 [1]  28 [2]  23 [3]   1 [4]   3 [5]   0
Hits@level+ = [0+] 134 [1+]  55 [2+]  27 [3+]   4 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 8.91728 [1+] 3.66008 [2+] 1.79677 [3+] 0.266188 [4+] 0.199641 [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.