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/mktorrent-1.1/ftw.c
Examining data/mktorrent-1.1/ftw.h
Examining data/mktorrent-1.1/hash.c
Examining data/mktorrent-1.1/hash_pthreads.c
Examining data/mktorrent-1.1/init.c
Examining data/mktorrent-1.1/main.c
Examining data/mktorrent-1.1/mktorrent.h
Examining data/mktorrent-1.1/output.c
Examining data/mktorrent-1.1/prefix.c
Examining data/mktorrent-1.1/sha1.c
Examining data/mktorrent-1.1/sha1.h

FINAL RESULTS:

data/mktorrent-1.1/init.c:111:3:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
		sprintf(string + length, DIRSEP "%s.torrent", m->torrent_name);
data/mktorrent-1.1/init.c:121:3:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
		sprintf(string + length, DIRSEP "%s", m->metainfo_file_path);
data/mktorrent-1.1/init.c:234:6:  [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(path, R_OK)) {
data/mktorrent-1.1/output.c:142: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(f, "10:created by13:mktorrent " VERSION);
data/mktorrent-1.1/init.c:440:14:  [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.
	while ((c = getopt_long(argc, argv, OPT_STRING,
data/mktorrent-1.1/init.c:443: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, OPT_STRING)) != -1) {
data/mktorrent-1.1/hash.c:91:13:  [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).
		if ((fd = open(f->path, OPENFLAGS)) == -1) {
data/mktorrent-1.1/hash_pthreads.c:61:11:  [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 data[1];
data/mktorrent-1.1/hash_pthreads.c:227:13:  [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).
		if ((fd = open(f->path, OPENFLAGS)) == -1) {
data/mktorrent-1.1/init.c:473: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).
			m->piece_length = atoi(optarg);
data/mktorrent-1.1/init.c:489:17:  [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).
			m->threads = atoi(optarg);
data/mktorrent-1.1/main.c:98: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(path, O_WRONLY | O_BINARY | O_CREAT | O_EXCL,
data/mktorrent-1.1/prefix.c:31: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 *prefix[9];
data/mktorrent-1.1/sha1.c:80: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(block, buffer, 64);
data/mktorrent-1.1/sha1.c:154: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(&context->buffer[j], data, (i = 64-j));
data/mktorrent-1.1/sha1.c:163: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(&context->buffer[j], &data[i], len - i);
data/mktorrent-1.1/sha1.c:238:4:  [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(c,"%02X", digest[i*4+j]);
data/mktorrent-1.1/sha1.c:252: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 output[80];
data/mktorrent-1.1/hash.c:104:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ssize_t d = read(fd, read_buf + r, m->piece_length - r);
data/mktorrent-1.1/hash_pthreads.c:189:3:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
		usleep(PROGRESS_PERIOD);
data/mktorrent-1.1/hash_pthreads.c:234:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ssize_t d = read(fd, p->data + r, m->piece_length - r);
data/mktorrent-1.1/init.c:101:11:  [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).
	length = strlen(string);
data/mktorrent-1.1/init.c:106:32:  [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).
		    realloc(string, length + strlen(m->torrent_name) + 10);
data/mktorrent-1.1/init.c:116:17:  [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).
			    length + strlen(m->metainfo_file_path) + 2);
data/mktorrent-1.1/output.c:51: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).
					(unsigned long)strlen(l->s), l->s);
data/mktorrent-1.1/output.c:82:40:  [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).
			fprintf(f, "%lu:%s", (unsigned long)strlen(a), a);
data/mktorrent-1.1/output.c:91: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).
		fprintf(f, "%lu:%see", (unsigned long)strlen(a), a);
data/mktorrent-1.1/output.c:107:39:  [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).
		fprintf(f, "%lu:%s", (unsigned long)strlen(list->s), list->s);
data/mktorrent-1.1/output.c:128: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).
			(unsigned long)strlen(m->announce_list->l->s),
data/mktorrent-1.1/output.c:139:20:  [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).
				(unsigned long)strlen(m->comment),
data/mktorrent-1.1/output.c:161:18:  [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).
		(unsigned long)strlen(m->torrent_name), m->torrent_name,
data/mktorrent-1.1/output.c:170: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).
		fprintf(f, "6:source%lu:%s", (unsigned long)strlen(m->source), m->source);
data/mktorrent-1.1/output.c:179: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).
					(unsigned long)strlen(m->web_seed_list->s),
data/mktorrent-1.1/sha1.c:241:3:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
		sprintf(c, " ");
data/mktorrent-1.1/sha1.c:259:50:  [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).
		SHA1_Update(&context, (uint8_t *)test_data[k], strlen(test_data[k]));

ANALYSIS SUMMARY:

Hits = 35
Lines analyzed = 2217 in approximately 0.09 seconds (25169 lines/second)
Physical Source Lines of Code (SLOC) = 1524
Hits@level = [0] 111 [1]  17 [2]  12 [3]   2 [4]   4 [5]   0
Hits@level+ = [0+] 146 [1+]  35 [2+]  18 [3+]   6 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 95.8005 [1+] 22.9659 [2+] 11.811 [3+] 3.93701 [4+] 2.62467 [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.