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/mtbl-1.3.0/t/test-fixed.c
Examining data/mtbl-1.3.0/t/test-crc32c.c
Examining data/mtbl-1.3.0/t/test-iter-seek.c
Examining data/mtbl-1.3.0/t/test-metadata.c
Examining data/mtbl-1.3.0/t/test-varint.c
Examining data/mtbl-1.3.0/t/test-vector.c
Examining data/mtbl-1.3.0/t/test-fileset-partition.c
Examining data/mtbl-1.3.0/t/test-sorted-merge.c
Examining data/mtbl-1.3.0/t/test-block_builder.c
Examining data/mtbl-1.3.0/t/test-compression.c
Examining data/mtbl-1.3.0/src/mtbl_info.c
Examining data/mtbl-1.3.0/src/mtbl_dump.c
Examining data/mtbl-1.3.0/src/mtbl_merge.c
Examining data/mtbl-1.3.0/src/mtbl_verify.c
Examining data/mtbl-1.3.0/mtbl/source.c
Examining data/mtbl-1.3.0/mtbl/crc32c_wrap.c
Examining data/mtbl-1.3.0/mtbl/writer.c
Examining data/mtbl-1.3.0/mtbl/metadata.c
Examining data/mtbl-1.3.0/mtbl/reader.c
Examining data/mtbl-1.3.0/mtbl/fixed.c
Examining data/mtbl-1.3.0/mtbl/mtbl.h
Examining data/mtbl-1.3.0/mtbl/block.c
Examining data/mtbl-1.3.0/mtbl/mtbl-private.h
Examining data/mtbl-1.3.0/mtbl/merger.c
Examining data/mtbl-1.3.0/mtbl/varint.c
Examining data/mtbl-1.3.0/mtbl/sorter.c
Examining data/mtbl-1.3.0/mtbl/fileset.c
Examining data/mtbl-1.3.0/mtbl/bytes.h
Examining data/mtbl-1.3.0/mtbl/block_builder.c
Examining data/mtbl-1.3.0/mtbl/compression.c
Examining data/mtbl-1.3.0/mtbl/iter.c
Examining data/mtbl-1.3.0/libmy/vector.h
Examining data/mtbl-1.3.0/libmy/heap.c
Examining data/mtbl-1.3.0/libmy/ubuf.h
Examining data/mtbl-1.3.0/libmy/print_string.h
Examining data/mtbl-1.3.0/libmy/crc32c.c
Examining data/mtbl-1.3.0/libmy/my_fileset.h
Examining data/mtbl-1.3.0/libmy/getenv_int.h
Examining data/mtbl-1.3.0/libmy/my_fileset.c
Examining data/mtbl-1.3.0/libmy/my_byteorder.h
Examining data/mtbl-1.3.0/libmy/crc32c-sse42.c
Examining data/mtbl-1.3.0/libmy/my_time.h
Examining data/mtbl-1.3.0/libmy/heap.h
Examining data/mtbl-1.3.0/libmy/crc32c.h
Examining data/mtbl-1.3.0/libmy/b64_encode.c
Examining data/mtbl-1.3.0/libmy/b64_encode.h
Examining data/mtbl-1.3.0/libmy/crc32c-slicing.c
Examining data/mtbl-1.3.0/libmy/my_alloc.h

FINAL RESULTS:

data/mtbl-1.3.0/libmy/ubuf.h:83:11:  [4] (format) vsnprintf:
  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.
	needed = vsnprintf(NULL, 0, fmt, args_copy);
data/mtbl-1.3.0/libmy/ubuf.h:88:11:  [4] (format) vsnprintf:
  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.
	status = vsnprintf((char *) ubuf_ptr(u), needed + 1, fmt, args);
data/mtbl-1.3.0/t/test-block_builder.c:101:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-block_builder.c:103:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/t/test-compression.c:44:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(fname, "%s/.mtbl." NAME ".%ld.XXXXXX", dirname, (long)getpid());
data/mtbl-1.3.0/t/test-compression.c:47:3:  [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.
		fprintf(stderr, NAME ": mkstemp() failed: %s\n", strerror(errno));
data/mtbl-1.3.0/t/test-compression.c:54:3:  [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.
		fprintf(stderr, NAME ": unlink() on file '%s' failed: %s\n",
data/mtbl-1.3.0/t/test-compression.c:66:3:  [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.
		fprintf(stderr, NAME ": dup() failed: %s\n", strerror(errno));
data/mtbl-1.3.0/t/test-compression.c:76:3:  [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.
		fprintf(stderr, NAME ": mtbl_writer_init_fd() failed\n");
data/mtbl-1.3.0/t/test-compression.c:83:3:  [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.
		fprintf(stderr, NAME ": mtbl_writer_add() failed\n");
data/mtbl-1.3.0/t/test-compression.c:93:3:  [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.
		fprintf(stderr, NAME ": mtbl_reader_init_fd() failed\n");
data/mtbl-1.3.0/t/test-compression.c:104:3:  [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.
		fprintf(stderr, NAME ": mtbl_metadata_compression_algorithm() "
data/mtbl-1.3.0/t/test-compression.c:113:3:  [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.
		fprintf(stderr, NAME ": mtbl_reader_source() failed\n");
data/mtbl-1.3.0/t/test-compression.c:121:3:  [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.
		fprintf(stderr, NAME ": mtbl_iter_next() failed\n");
data/mtbl-1.3.0/t/test-compression.c:127:3:  [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.
		fprintf(stderr, NAME ": len_it_key != len_key\n");
data/mtbl-1.3.0/t/test-compression.c:131:3:  [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.
		fprintf(stderr, NAME ": len_it_val != len_val\n");
data/mtbl-1.3.0/t/test-compression.c:135:3:  [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.
		fprintf(stderr, NAME ": it_key != key\n");
data/mtbl-1.3.0/t/test-compression.c:139:3:  [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.
		fprintf(stderr, NAME ": it_val != val\n");
data/mtbl-1.3.0/t/test-compression.c:146:3:  [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.
		fprintf(stderr, NAME ": mtbl_iter_next() returned an "
data/mtbl-1.3.0/t/test-compression.c:164:3:  [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.
		fprintf(stderr, NAME ": PASS: %s %s\n", s1, s2);
data/mtbl-1.3.0/t/test-compression.c:166:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s %s\n", s1, s2);
data/mtbl-1.3.0/t/test-fileset-partition.c:54:3:  [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.
		fprintf (stderr, NAME ": m1 does not have any keys\n");
data/mtbl-1.3.0/t/test-fileset-partition.c:58:4:  [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.
			fprintf (stderr, NAME ": '%.*s' != 'file1'\n", (int)len_key, (char*)key);
data/mtbl-1.3.0/t/test-fileset-partition.c:62:3:  [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.
		fprintf (stderr, NAME ": m1 has too many keys\n");
data/mtbl-1.3.0/t/test-fileset-partition.c:69:3:  [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.
		fprintf (stderr, NAME ": m2 does not have any keys\n");
data/mtbl-1.3.0/t/test-fileset-partition.c:73:4:  [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.
			fprintf (stderr, NAME ": '%.*s' != 'file2'\n", (int)len_key, (char*)key);
data/mtbl-1.3.0/t/test-fileset-partition.c:77:3:  [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.
		fprintf (stderr, NAME ": m2 does not have enough keys\n");
data/mtbl-1.3.0/t/test-fileset-partition.c:81:4:  [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.
			fprintf (stderr, NAME ": '%.*s' != 'file3'\n", (int)len_key, (char*)key);
data/mtbl-1.3.0/t/test-fileset-partition.c:85:3:  [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.
		fprintf (stderr, NAME ": m2 has too many keys\n");
data/mtbl-1.3.0/t/test-fileset-partition.c:102:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-fileset-partition.c:104:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/t/test-fileset-partition.c:113:3:  [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.
		fprintf(stderr, NAME ": ERROR. Need fileset argument.\n");
data/mtbl-1.3.0/t/test-fixed.c:87:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-fixed.c:89:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/t/test-iter-seek.c:51:2:  [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.
	fprintf(stderr, NAME ": PASS: iter run successful\n");
data/mtbl-1.3.0/t/test-iter-seek.c:72:2:  [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.
	fprintf(stderr, NAME ": PASS: merger run 1 successful\n");
data/mtbl-1.3.0/t/test-iter-seek.c:90:2:  [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.
	fprintf(stderr, NAME ": PASS: merger run 2 successful\n");
data/mtbl-1.3.0/t/test-metadata.c:26:3:  [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.
		fprintf(stderr, NAME ": metadata_read() should have failed but didn't\n");
data/mtbl-1.3.0/t/test-metadata.c:36:3:  [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.
		fprintf(stderr, NAME ": " #x "." #attr " != " #y "." #attr); \
data/mtbl-1.3.0/t/test-metadata.c:63:3:  [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.
		fprintf(stderr, NAME ": metadata_read() failed\n");
data/mtbl-1.3.0/t/test-metadata.c:85:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-metadata.c:87:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/t/test-sorted-merge.c:89:8:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
		if ((access(fnamebuf, W_OK) == -1) && (errno == ENOENT)) {
data/mtbl-1.3.0/t/test-sorted-merge.c:201:3:  [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.
		fprintf(stderr, NAME ": PASS: %s initialization successful\n",
data/mtbl-1.3.0/t/test-sorted-merge.c:283:3:  [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.
		fprintf(stderr, NAME ": PASS: %s run successful\n",
data/mtbl-1.3.0/t/test-sorted-merge.c:326:3:  [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).
		strcpy(((char *)*merged_val), MERGE_DUP);
data/mtbl-1.3.0/t/test-varint.c:156:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-varint.c:158:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/t/test-vector.c:156:3:  [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.
		fprintf(stderr, NAME ": PASS: %s\n", s);
data/mtbl-1.3.0/t/test-vector.c:158:3:  [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.
		fprintf(stderr, NAME ": FAIL: %s\n", s);
data/mtbl-1.3.0/libmy/getenv_int.h:12:6:  [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.
	s = getenv(name);
data/mtbl-1.3.0/mtbl/reader.c:120:6:  [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.
	s = getenv("MTBL_READER_MADVISE_RANDOM");
data/mtbl-1.3.0/src/mtbl_dump.c:70: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 ((c = getopt(argc, argv, "s")) != -1) {
data/mtbl-1.3.0/src/mtbl_merge.c:167:19:  [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.
	merge_dso_path = getenv("MTBL_MERGE_DSO");
data/mtbl-1.3.0/src/mtbl_merge.c:168: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.
	merge_dso_prefix = getenv("MTBL_MERGE_FUNC_PREFIX");
data/mtbl-1.3.0/src/mtbl_merge.c:287:6:  [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("MTBL_MERGE_BLOCK_SIZE") != NULL) {
data/mtbl-1.3.0/src/mtbl_merge.c:319: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 ((c = getopt(argc, argv, "b:c:")) != -1) {
data/mtbl-1.3.0/src/mtbl_verify.c:213: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 ((c = getopt(argc, argv, "p")) != -1) {
data/mtbl-1.3.0/libmy/my_fileset.c:169:7:  [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).
	fp = fopen(fs->setfile, "r");
data/mtbl-1.3.0/libmy/vector.h:99: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((vec)->_v + (vec)->_n, elems, (n_elems) * sizeof(type));	\
data/mtbl-1.3.0/mtbl/block_builder.c:152: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(ubuf_ptr(b->buf), key + shared, non_shared);
data/mtbl-1.3.0/mtbl/block_builder.c:155: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(ubuf_ptr(b->buf), val, len_val);
data/mtbl-1.3.0/mtbl/bytes.h:35: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(&ubuf_data(start)[diff_index], &u_between, sizeof(u_between));
data/mtbl-1.3.0/mtbl/fixed.c:53: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(dst, &value, sizeof(value));
data/mtbl-1.3.0/mtbl/fixed.c:61: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(dst, &value, sizeof(value));
data/mtbl-1.3.0/mtbl/merger.c:116: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(&m->opt, opt, sizeof(*opt));
data/mtbl-1.3.0/mtbl/reader.c:157: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(&r->opt, opt, sizeof(*opt));
data/mtbl-1.3.0/mtbl/reader.c:216: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).
	fd = open(fname, O_RDONLY);
data/mtbl-1.3.0/mtbl/sorter.c:114: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(&s->opt, opt, sizeof(*opt));
data/mtbl-1.3.0/mtbl/sorter.c:161: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 template[64];
data/mtbl-1.3.0/mtbl/sorter.c:162:2:  [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(template, "/.mtbl.%ld.XXXXXX", (long)getpid());
data/mtbl-1.3.0/mtbl/sorter.c:168:10:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
	c->fd = mkstemp((char *) ubuf_data(tmp_fname));
data/mtbl-1.3.0/mtbl/sorter.c:207:5:  [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(entry_key(merge_ent), entry_key(ent), ent->len_key);
data/mtbl-1.3.0/mtbl/sorter.c:208:5:  [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(entry_val(merge_ent), merge_val, len_merge_val);
data/mtbl-1.3.0/mtbl/sorter.c:271: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(entry_key(ent), key, len_key);
data/mtbl-1.3.0/mtbl/sorter.c:272: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(entry_val(ent), val, len_val);
data/mtbl-1.3.0/mtbl/writer.c:125: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(&w->opt, opt, sizeof(*opt));
data/mtbl-1.3.0/mtbl/writer.c:147: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).
	fd = open(fname, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644);
data/mtbl-1.3.0/src/mtbl_info.c:39: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).
	fd = open(fname, O_RDONLY);
data/mtbl-1.3.0/src/mtbl_verify.c:170: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).
	fd = open(fname, O_RDONLY);
data/mtbl-1.3.0/t/test-compression.c:43: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 fname[strlen(dirname) + 100];
data/mtbl-1.3.0/t/test-compression.c:45:11:  [2] (tmpfile) mkstemp:
  Potential for temporary file vulnerability in some circumstances. Some
  older Unix-like systems create temp files with permission to write by all
  by default, so be sure to set the umask to override this. Also, some older
  Unix systems might fail to use O_EXCL when opening the file, so make sure
  that O_EXCL is used by the library (CWE-377).
	int fd = mkstemp(fname);
data/mtbl-1.3.0/t/test-iter-seek.c:33:14:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
	FILE *tmp = tmpfile();
data/mtbl-1.3.0/t/test-iter-seek.c:76:15:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
	FILE *tmp2 = tmpfile();
data/mtbl-1.3.0/t/test-iter-seek.c:176: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(*merged_val, val0, len_val0);
data/mtbl-1.3.0/t/test-sorted-merge.c:53:1:  [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 *key_values[NUM_SETS][NUM_KEYS] = {
data/mtbl-1.3.0/t/test-sorted-merge.c:58:1:  [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 *sorted_values[NUM_SORTED] = {
data/mtbl-1.3.0/t/test-sorted-merge.c:72: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 fnamebuf[1024], dirbuf[1024];
data/mtbl-1.3.0/t/test-sorted-merge.c:330: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(*merged_val, val0, len_val0);
data/mtbl-1.3.0/libmy/ubuf.h:40:15:  [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(s);
data/mtbl-1.3.0/libmy/ubuf.h:51:38:  [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).
	ubuf_append(u, (const uint8_t *) s, strlen(s));
data/mtbl-1.3.0/mtbl/sorter.c:163: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).
	ubuf *tmp_fname = ubuf_init(strlen(s->opt.tmp_dname) + strlen(template) + 1);
data/mtbl-1.3.0/mtbl/sorter.c:163:57:  [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).
	ubuf *tmp_fname = ubuf_init(strlen(s->opt.tmp_dname) + strlen(template) + 1);
data/mtbl-1.3.0/mtbl/sorter.c:164:55:  [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).
	ubuf_append(tmp_fname, (uint8_t *) s->opt.tmp_dname, strlen(s->opt.tmp_dname));
data/mtbl-1.3.0/mtbl/sorter.c:165: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).
	ubuf_append(tmp_fname, (uint8_t *) template, strlen(template));
data/mtbl-1.3.0/src/mtbl_merge.c:190:7:  [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).
		    strlen(merge_dso_prefix));
data/mtbl-1.3.0/src/mtbl_merge.c:204:7:  [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).
		    strlen(merge_dso_prefix));
data/mtbl-1.3.0/src/mtbl_merge.c:216:7:  [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).
		    strlen(merge_dso_prefix));
data/mtbl-1.3.0/t/test-compression.c:43: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).
	char fname[strlen(dirname) + 100];
data/mtbl-1.3.0/t/test-sorted-merge.c:264:5:  [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).
				strlen(sorted_values[total - 1]) + 1, key, len_key) == 0);
data/mtbl-1.3.0/t/test-sorted-merge.c:276:6:  [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).
					strlen(sorted_values[total - 1]) + 1, value, len_value) == 0);
data/mtbl-1.3.0/t/test-sorted-merge.c:305:61:  [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).
		assert(bytes_compare((const uint8_t *)key_values[idx][i], strlen(key_values[idx][i]) + 1, key, len_key) == 0);
data/mtbl-1.3.0/t/test-sorted-merge.c:325: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).
		*merged_val = my_calloc(1, strlen(MERGE_DUP) + 1);
data/mtbl-1.3.0/t/test-sorted-merge.c:327: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).
		*len_merged_val = strlen(MERGE_DUP) + 1;
data/mtbl-1.3.0/t/test-sorted-merge.c:348:71:  [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).
		assert(mtbl_writer_add(writer, (const uint8_t *)key_values[idx][i], strlen(key_values[idx][i]) + 1,
data/mtbl-1.3.0/t/test-sorted-merge.c:349: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).
			(const uint8_t *)key_values[idx][i], strlen(key_values[idx][i]) + 1) == mtbl_res_success);

ANALYSIS SUMMARY:

Hits = 106
Lines analyzed = 9381 in approximately 0.28 seconds (33308 lines/second)
Physical Source Lines of Code (SLOC) = 7317
Hits@level = [0]  63 [1]  17 [2]  31 [3]   8 [4]  50 [5]   0
Hits@level+ = [0+] 169 [1+] 106 [2+]  89 [3+]  58 [4+]  50 [5+]   0
Hits/KSLOC@level+ = [0+] 23.0969 [1+] 14.4868 [2+] 12.1635 [3+] 7.92675 [4+] 6.8334 [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.