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/curlftpfs-0.9.2/cache.h Examining data/curlftpfs-0.9.2/ftpfs-ls.h Examining data/curlftpfs-0.9.2/charset_utils.c Examining data/curlftpfs-0.9.2/charset_utils.h Examining data/curlftpfs-0.9.2/path_utils.c Examining data/curlftpfs-0.9.2/path_utils.h Examining data/curlftpfs-0.9.2/ftpfs.h Examining data/curlftpfs-0.9.2/compat/fuse_opt.c Examining data/curlftpfs-0.9.2/compat/fuse_opt.h Examining data/curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c Examining data/curlftpfs-0.9.2/cache.c Examining data/curlftpfs-0.9.2/ftpfs-ls.c Examining data/curlftpfs-0.9.2/ftpfs.c FINAL RESULTS: data/curlftpfs-0.9.2/cache.c:251:33: [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->oper.readlink(path, buf, size); data/curlftpfs-0.9.2/cache.c:383:37: [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->oper.chmod(path, mode); data/curlftpfs-0.9.2/cache.c:391:37: [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->oper.chown(path, uid, gid); data/curlftpfs-0.9.2/cache.c:463:42: [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->oper.readlink; data/curlftpfs-0.9.2/cache.c:472:42: [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->oper.chmod; data/curlftpfs-0.9.2/cache.c:473:42: [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->oper.chown; data/curlftpfs-0.9.2/cache.c:502:42: [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->oper.readlink ? cache_readlink : NULL; data/curlftpfs-0.9.2/cache.c:511:42: [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->oper.chmod ? cache_chmod : NULL; data/curlftpfs-0.9.2/cache.c:512:42: [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->oper.chown ? cache_chown : NULL; data/curlftpfs-0.9.2/compat/fuse_opt.c:90: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/curlftpfs-0.9.2/compat/fuse_opt.c:181: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/curlftpfs-0.9.2/compat/fuse_opt.c:228: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/curlftpfs-0.9.2/ftpfs-ls.c:81: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(link, link_marker + 4); data/curlftpfs-0.9.2/ftpfs-ls.c:108:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(date,"%s,%s,%s", year, month, day); data/curlftpfs-0.9.2/ftpfs.c:39:14: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. extern char *getpass(const char *prompt); data/curlftpfs-0.9.2/ftpfs.c:1693:14: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. passwd = getpass(prompt); data/curlftpfs-0.9.2/ftpfs.h:79:16: [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, __FILE__ ":%d ", __LINE__);\ data/curlftpfs-0.9.2/ftpfs.h:80:16: [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, args);\ data/curlftpfs-0.9.2/ftpfs.c:1784: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. else if (realpath(ftpfs.mountpoint, ftpfs.symlink_prefix) != NULL) data/curlftpfs-0.9.2/cache.c:476:42: [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->oper.open; data/curlftpfs-0.9.2/compat/fuse_opt.c:227: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/curlftpfs-0.9.2/ftpfs-ls.c:33: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 mode[12]; data/curlftpfs-0.9.2/ftpfs-ls.c:35: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 user[33]; data/curlftpfs-0.9.2/ftpfs-ls.c:36: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 group[33]; data/curlftpfs-0.9.2/ftpfs-ls.c:38: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 month[4]; data/curlftpfs-0.9.2/ftpfs-ls.c:39: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 day[3]; data/curlftpfs-0.9.2/ftpfs-ls.c:40: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 year[6]; data/curlftpfs-0.9.2/ftpfs-ls.c:41: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 date[20]; data/curlftpfs-0.9.2/ftpfs-ls.c:133: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 date[9]; data/curlftpfs-0.9.2/ftpfs-ls.c:134: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 hour[8]; data/curlftpfs-0.9.2/ftpfs-ls.c:135: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 size[33]; data/curlftpfs-0.9.2/ftpfs.c:42:8: [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 error_buf[CURL_ERROR_SIZE]; data/curlftpfs-0.9.2/ftpfs.c:88: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(buf->p + buf->len, data, len); data/curlftpfs-0.9.2/ftpfs.c:120: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 curl_error_buffer[CURL_ERROR_SIZE]; data/curlftpfs-0.9.2/ftpfs.c:232: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(ptr, fh->buf.p + fh->copied, to_copy); data/curlftpfs-0.9.2/ftpfs.c:363:9: [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 range[15]; data/curlftpfs-0.9.2/ftpfs.c:429: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(rbuf, fh->buf.p + offset - fh->buf.begin_offset, size); data/curlftpfs-0.9.2/ftpfs.c:479: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(ptr, fh->stream_buf.p, to_copy); data/curlftpfs-0.9.2/ftpfs.c:501: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 range[15]; data/curlftpfs-0.9.2/ftpfs.c:1682: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 prompt[256]; data/curlftpfs-0.9.2/ftpfs.c:1704:7: [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(&passptr[userlen+1], passwd, passwdlen+1); data/curlftpfs-0.9.2/ftpfs.h:62: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 symlink_prefix[PATH_MAX+1]; data/curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c:45: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[256]; data/curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c:50: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 linkbuf[1024]; data/curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c:51: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 date[20]; data/curlftpfs-0.9.2/cache.c:244:13: [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/curlftpfs-0.9.2/cache.c:477:42: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). cache_oper->read = oper->oper.read; data/curlftpfs-0.9.2/charset_utils.c:32: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). ibl = strlen(s) + 1; data/curlftpfs-0.9.2/compat/fuse_opt.c:86: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/curlftpfs-0.9.2/compat/fuse_opt.c:87: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/curlftpfs-0.9.2/compat/fuse_opt.c:136: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/curlftpfs-0.9.2/compat/fuse_opt.c:223: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/curlftpfs-0.9.2/ftpfs-ls.c:51:9: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. res = sscanf(line, data/curlftpfs-0.9.2/ftpfs-ls.c:63:11: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. res = sscanf(line, data/curlftpfs-0.9.2/ftpfs-ls.c:145:9: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. res = sscanf(line, "%8s%*[ \t]%7s%*[ \t]%32s%*[ \t]%1023c", data/curlftpfs-0.9.2/ftpfs-ls.c:223:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(line, start, end - start); data/curlftpfs-0.9.2/ftpfs-ls.c:246: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). int linksize = strlen(reallink); data/curlftpfs-0.9.2/ftpfs-ls.c:253:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(linkbuf, reallink, linksize); data/curlftpfs-0.9.2/ftpfs.c:279: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). parse_dir((char*)buf.p, dir_path + strlen(ftpfs.host) - 1, data/curlftpfs-0.9.2/ftpfs.c:311:44: [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). err = parse_dir((char*)buf.p, dir_path + strlen(ftpfs.host) - 1, data/curlftpfs-0.9.2/ftpfs.c:1324:44: [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). err = parse_dir((char*)buf.p, dir_path + strlen(ftpfs.host) - 1, data/curlftpfs-0.9.2/ftpfs.c:1419:8: [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). arg[strlen(arg)-1] == '/' ? "" : "/"); data/curlftpfs-0.9.2/ftpfs.c:1684:22: [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 userlen = strlen(*userpwd); data/curlftpfs-0.9.2/ftpfs.c:1694: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). passwdlen = strlen(passwd); data/curlftpfs-0.9.2/ftpfs.c:1785: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). ftpfs.symlink_prefix_len = strlen(ftpfs.symlink_prefix); data/curlftpfs-0.9.2/path_utils.c:36: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 (ftpfs.codepage && strlen(path)) { data/curlftpfs-0.9.2/path_utils.c:55: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 (ftpfs.codepage && strlen(path)) { data/curlftpfs-0.9.2/path_utils.c:61: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). ret = g_strdup_printf("%s%s%s", ftpfs.host, path, strlen(path) ? "/" : ""); data/curlftpfs-0.9.2/path_utils.c:82:22: [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). lastdir = path + strlen(path); ANALYSIS SUMMARY: Hits = 69 Lines analyzed = 3703 in approximately 0.15 seconds (25516 lines/second) Physical Source Lines of Code (SLOC) = 2846 Hits@level = [0] 31 [1] 24 [2] 26 [3] 1 [4] 9 [5] 9 Hits@level+ = [0+] 100 [1+] 69 [2+] 45 [3+] 19 [4+] 18 [5+] 9 Hits/KSLOC@level+ = [0+] 35.137 [1+] 24.2446 [2+] 15.8117 [3+] 6.67604 [4+] 6.32467 [5+] 3.16233 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.