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/metastore-1.1.2/src/metaentry.c
Examining data/metastore-1.1.2/src/metaentry.h
Examining data/metastore-1.1.2/src/metastore.c
Examining data/metastore-1.1.2/src/metastore.h
Examining data/metastore-1.1.2/src/settings.h
Examining data/metastore-1.1.2/src/utils.c
Examining data/metastore-1.1.2/src/utils.h

FINAL RESULTS:

data/metastore-1.1.2/src/metastore.c:210:7:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
		if (chmod(real->path, stored->mode & 07777))
data/metastore-1.1.2/src/metaentry.c:320:3:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
		strcat(result, real + strlen(cwd));
data/metastore-1.1.2/src/utils.c:62:9:  [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.
		ret = vfprintf(stderr, fmt, ap);
data/metastore-1.1.2/src/utils.c:64:9:  [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.
		ret = vfprintf(stdout, fmt, ap);
data/metastore-1.1.2/src/metaentry.c:308:15:  [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 *real = realpath(orig, NULL);
data/metastore-1.1.2/src/metastore.c:469:7:  [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.
		c = getopt_long(argc, argv, "csadVhvqmeEgf:",
data/metastore-1.1.2/src/metaentry.c:309: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 cwd[PATH_MAX];
data/metastore-1.1.2/src/metaentry.c:335: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 tpath[PATH_MAX];
data/metastore-1.1.2/src/metaentry.c:398: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).
	to = fopen(path, "w");
data/metastore-1.1.2/src/metaentry.c:444: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_RDONLY);
data/metastore-1.1.2/src/metaentry.c:649: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 mode[11 + 1] = "";
data/metastore-1.1.2/src/metaentry.c:650: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 date[12 + 2 + 2 + 2*1 + 1 + 2 + 2 + 2 + 2*1 + 1] = "";
data/metastore-1.1.2/src/metaentry.c:651: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 zone[5 + 1] = "";
data/metastore-1.1.2/src/utils.c:123: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[len];
data/metastore-1.1.2/src/utils.c:177: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(result, *from, len);
data/metastore-1.1.2/src/metaentry.c:221: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).
	mentry->pathlen = strlen(mentry->path);
data/metastore-1.1.2/src/metaentry.c:316:26:  [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).
	if (!strncmp(real, cwd, strlen(cwd))) {
data/metastore-1.1.2/src/metaentry.c:317: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).
		result = xmalloc(strlen(real) - strlen(cwd) + 1 + 1);
data/metastore-1.1.2/src/metaentry.c:317:35:  [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).
		result = xmalloc(strlen(real) - strlen(cwd) + 1 + 1);
data/metastore-1.1.2/src/metaentry.c:319:3:  [1] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused). Risk is low because the
  source is a constant character.
		strcat(result, ".");
data/metastore-1.1.2/src/metaentry.c:320:25:  [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).
		strcat(result, real + strlen(cwd));
data/metastore-1.1.2/src/metaentry.c:493: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).
		mentry->pathlen = strlen(mentry->path);
data/metastore-1.1.2/src/metastore.c:316: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).
		blen = strlen(bpath);
data/metastore-1.1.2/src/utils.c:88:53:  [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).
		msg(MSG_CRITICAL, "Failed to strdup %zi bytes\n", strlen(s));
data/metastore-1.1.2/src/utils.c:142: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).
	xfwrite(string, strlen(string) + 1, to);
data/metastore-1.1.2/src/utils.c:186:34:  [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).
	return read_binary_string(from, strlen(*from) + 1, max);

ANALYSIS SUMMARY:

Hits = 26
Lines analyzed = 1814 in approximately 0.07 seconds (25399 lines/second)
Physical Source Lines of Code (SLOC) = 1271
Hits@level = [0]   7 [1]  11 [2]   9 [3]   2 [4]   3 [5]   1
Hits@level+ = [0+]  33 [1+]  26 [2+]  15 [3+]   6 [4+]   4 [5+]   1
Hits/KSLOC@level+ = [0+] 25.9638 [1+] 20.4563 [2+] 11.8017 [3+] 4.72069 [4+] 3.14713 [5+] 0.786782
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.