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/sshfs-fuse-3.7.1+repack/cache.c
Examining data/sshfs-fuse-3.7.1+repack/cache.h
Examining data/sshfs-fuse-3.7.1+repack/compat/darwin_compat.c
Examining data/sshfs-fuse-3.7.1+repack/compat/darwin_compat.h
Examining data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c
Examining data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.h
Examining data/sshfs-fuse-3.7.1+repack/sshfs.c
Examining data/sshfs-fuse-3.7.1+repack/test/wrong_command.c

FINAL RESULTS:

data/sshfs-fuse-3.7.1+repack/cache.c:296:25:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	err = cache.next_oper->readlink(path, buf, size);
data/sshfs-fuse-3.7.1+repack/cache.c:475:29:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	int err = cache.next_oper->chmod(path, mode, fi);
data/sshfs-fuse-3.7.1+repack/cache.c:484:29:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
	int err = cache.next_oper->chown(path, uid, gid, fi);
data/sshfs-fuse-3.7.1+repack/cache.c:530:31:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	cache_oper->chmod    = oper->chmod ? cache_chmod : NULL;
data/sshfs-fuse-3.7.1+repack/cache.c:531:31:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
	cache_oper->chown    = oper->chown ? cache_chown : NULL;
data/sshfs-fuse-3.7.1+repack/cache.c:546:31:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	cache_oper->readlink = oper->readlink ? cache_readlink : NULL;
data/sshfs-fuse-3.7.1+repack/cache.c:529:31:  [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.
	cache_oper->access   = oper->access;
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:105:13:  [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(newopts + oldlen + 1, opt);
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:184:13:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function. If the scanf format is influenceable by an
  attacker, it's exploitable.
        if (sscanf(param, format, var) != 1) {
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:231:5:  [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(newarg + sep, param);
data/sshfs-fuse-3.7.1+repack/sshfs.c:562:24:  [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.
	do { if (sshfs.debug) fprintf(stderr, format, args); } while(0)
data/sshfs-fuse-3.7.1+repack/sshfs.c:1225:3:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
		execvp(sshfs.ssh_args.argv[0], sshfs.ssh_args.argv);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2144: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(s, l);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2510:4:  [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(totmp, to);
data/sshfs-fuse-3.7.1+repack/sshfs.c:749:8:  [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 *realpath;
data/sshfs-fuse-3.7.1+repack/sshfs.c:771:22:  [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.
	buf_add_string(buf, realpath);
data/sshfs-fuse-3.7.1+repack/sshfs.c:772:9:  [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.
	g_free(realpath);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3708:18:  [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.
					dir = tmp ? realpath(tmp, NULL) : 0;
data/sshfs-fuse-3.7.1+repack/sshfs.c:3712:12:  [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.
					dir = realpath(".", NULL);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3733:24:  [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.
				sshfs.mountpoint = realpath(arg, NULL);
data/sshfs-fuse-3.7.1+repack/sshfs.c:4162:7:  [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.
	if (!realpath(*exec_path, sshfs_program_path)) {
data/sshfs-fuse-3.7.1+repack/cache.c:490:32:  [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 int cache_utimens(const char *path, const struct timespec tv[2],
data/sshfs-fuse-3.7.1+repack/cache.c:542:31:  [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).
	cache_oper->open     = oper->open;
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:230: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(newarg, arg, sep);
data/sshfs-fuse-3.7.1+repack/sshfs.c:211: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.
   static char sshfs_program_path[PATH_MAX] = { 0 };
data/sshfs-fuse-3.7.1+repack/sshfs.c:701: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(b->p + b->len, d, l);		\
data/sshfs-fuse-3.7.1+repack/sshfs.c:788: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(data, buf->p + buf->len, len);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1003: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[256];
data/sshfs-fuse-3.7.1+repack/sshfs.c:1111:8:  [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).
	mfd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1151:24:  [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).
		sshfs.ptypassivefd = open(ptyname, O_RDWR | O_NOCTTY);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1171: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).
		devnull = open("/dev/null", O_WRONLY);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1205:10:  [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).
			sfd = open(ptyname, O_RDWR);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2141:3:  [2] (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). Risk is low because the source is a constant string.
		strcpy(s, "../");
data/sshfs-fuse-3.7.1+repack/sshfs.c:2509:4:  [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 totmp[PATH_MAX];
data/sshfs-fuse-3.7.1+repack/sshfs.c:2662:32:  [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 int sshfs_utimens(const char *path, const struct timespec tv[2],
data/sshfs-fuse-3.7.1+repack/sshfs.c:3988: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 *tokens[IDMAP_FIELDS];
data/sshfs-fuse-3.7.1+repack/sshfs.c:4028: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[LINE_MAX];
data/sshfs-fuse-3.7.1+repack/sshfs.c:4032: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(file, "r");
data/sshfs-fuse-3.7.1+repack/cache.c:144: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).
	if (strncmp(key, path, strlen(path)) == 0)
data/sshfs-fuse-3.7.1+repack/cache.c:289:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(buf, node->link, size-1);
data/sshfs-fuse-3.7.1+repack/cache.c:544:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	cache_oper->read     = oper->read;
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:101:27:  [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 oldlen = strlen(*opts);
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:102: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).
        newopts = realloc(*opts, oldlen + 1 + strlen(opt) + 1);
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:139: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).
    int arglen = strlen(arg);
data/sshfs-fuse-3.7.1+repack/compat/fuse_opt.c:226:27:  [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).
    newarg = malloc(sep + strlen(param) + 1);
data/sshfs-fuse-3.7.1+repack/sshfs.c:743: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).
	data.len = strlen(str);
data/sshfs-fuse-3.7.1+repack/sshfs.c:753:24:  [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 (sshfs.base_path[strlen(sshfs.base_path)-1] != '/') {
data/sshfs-fuse-3.7.1+repack/sshfs.c:1006: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 passwd_len = strlen(passwd_str);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1036:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		res = read(sshfs.ptyfd, &c, 1);
data/sshfs-fuse-3.7.1+repack/sshfs.c:1050: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).
				      strlen(sshfs.password));
data/sshfs-fuse-3.7.1+repack/sshfs.c:1365:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		res = read(conn->rfd, p, size);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2135:33:  [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).
	newlink = malloc(dotdots * 3 + strlen(l) + 2);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2146:3:  [1] (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). Risk is low because the source is a constant character.
		strcpy(s, ".");
data/sshfs-fuse-3.7.1+repack/sshfs.c:2177:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(linkbuf, link, size - 1);
data/sshfs-fuse-3.7.1+repack/sshfs.c:2506: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).
		size_t tolen = strlen(to);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3656: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 arglen = strlen(arg);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3659: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 olen = strlen(*o);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3724: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).
			    len == strlen(arg)) {
data/sshfs-fuse-3.7.1+repack/sshfs.c:3825:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		res = read(0, &sshfs.password[n], 1);
data/sshfs-fuse-3.7.1+repack/sshfs.c:3936: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).
	char *fsname = g_malloc(strlen(fsnameold) * 2 + 1);

ANALYSIS SUMMARY:

Hits = 60
Lines analyzed = 5993 in approximately 0.17 seconds (35210 lines/second)
Physical Source Lines of Code (SLOC) = 4792
Hits@level = [0]  73 [1]  22 [2]  17 [3]   7 [4]   8 [5]   6
Hits@level+ = [0+] 133 [1+]  60 [2+]  38 [3+]  21 [4+]  14 [5+]   6
Hits/KSLOC@level+ = [0+] 27.7546 [1+] 12.5209 [2+] 7.92988 [3+] 4.3823 [4+] 2.92154 [5+] 1.25209
Dot directories skipped = 2 (--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.