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/fstransform-0.9.4/fsattr/src/e4attr.cc Examining data/fstransform-0.9.4/fsattr/src/main.cc Examining data/fstransform-0.9.4/fsmount_kernel/src/main.cc Examining data/fstransform-0.9.4/fsmove/src/args.cc Examining data/fstransform-0.9.4/fsmove/src/io/disk_stat.cc Examining data/fstransform-0.9.4/fsmove/src/io/io.cc Examining data/fstransform-0.9.4/fsmove/src/io/io_posix.cc Examining data/fstransform-0.9.4/fsmove/src/io/io_prealloc.cc Examining data/fstransform-0.9.4/fsmove/src/io/util_posix.cc Examining data/fstransform-0.9.4/fsmove/src/main.cc Examining data/fstransform-0.9.4/fsmove/src/move.cc Examining data/fstransform-0.9.4/fsmove/src/rope/rope.cc Examining data/fstransform-0.9.4/fsmove/src/rope/rope_impl.cc Examining data/fstransform-0.9.4/fsmove/src/rope/rope_list.cc Examining data/fstransform-0.9.4/fsmove/src/rope/rope_pool.cc Examining data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc Examining data/fstransform-0.9.4/fsmove/src/zstring.cc Examining data/fstransform-0.9.4/fsremap/src/arch/mem.cc Examining data/fstransform-0.9.4/fsremap/src/arch/mem_linux.cc Examining data/fstransform-0.9.4/fsremap/src/arch/mem_posix.cc Examining data/fstransform-0.9.4/fsremap/src/args.cc Examining data/fstransform-0.9.4/fsremap/src/assert.cc Examining data/fstransform-0.9.4/fsremap/src/cache/cache_symlink.cc Examining data/fstransform-0.9.4/fsremap/src/copy.cc Examining data/fstransform-0.9.4/fsremap/src/dispatch.cc Examining data/fstransform-0.9.4/fsremap/src/eta.cc Examining data/fstransform-0.9.4/fsremap/src/io/extent_file.cc Examining data/fstransform-0.9.4/fsremap/src/io/extent_posix.cc Examining data/fstransform-0.9.4/fsremap/src/io/io.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_null.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_posix.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_posix_dir.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_self_test.cc Examining data/fstransform-0.9.4/fsremap/src/io/io_test.cc Examining data/fstransform-0.9.4/fsremap/src/io/persist.cc Examining data/fstransform-0.9.4/fsremap/src/io/util_dir.cc Examining data/fstransform-0.9.4/fsremap/src/io/util_posix.cc Examining data/fstransform-0.9.4/fsremap/src/job.cc Examining data/fstransform-0.9.4/fsremap/src/log.cc Examining data/fstransform-0.9.4/fsremap/src/main.cc Examining data/fstransform-0.9.4/fsremap/src/map.cc Examining data/fstransform-0.9.4/fsremap/src/map_stat.cc Examining data/fstransform-0.9.4/fsremap/src/misc.cc Examining data/fstransform-0.9.4/fsremap/src/mstring.cc Examining data/fstransform-0.9.4/fsremap/src/pool.cc Examining data/fstransform-0.9.4/fsremap/src/remap.cc Examining data/fstransform-0.9.4/fsremap/src/tmp_zero.cc Examining data/fstransform-0.9.4/fsremap/src/ui/ui.cc Examining data/fstransform-0.9.4/fsremap/src/ui/ui_tty.cc Examining data/fstransform-0.9.4/fsremap/src/unsorted_map.cc Examining data/fstransform-0.9.4/fsremap/src/vector.cc Examining data/fstransform-0.9.4/fsremap/src/work.cc Examining data/fstransform-0.9.4/fstransform/src/main.cc Examining data/fstransform-0.9.4/fstransform/src/transform.cc FINAL RESULTS: data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:414:32: [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. ssize_t link_len = readlink(source, link_to, PATH_MAX); data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:966:28: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (!is_symlink && chown(target, stat.st_uid, stat.st_gid) != 0) data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:981:28: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (!is_symlink && chmod(target, stat.st_mode) != 0) { data/fstransform-0.9.4/fsremap/src/cache/cache_symlink.cc:132:23: [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. int ft_cache_symlink::readlink(const ft_string & src, ft_string & dst) data/fstransform-0.9.4/fsremap/src/cache/cache_symlink.cc:138:13: [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. got = ::readlink(src.c_str(), &dst[0], len); data/fstransform-0.9.4/fsremap/src/cache/cache_symlink.cc:168:15: [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. int err = readlink(link_from, payload); data/fstransform-0.9.4/fsremap/src/cache/cache_symlink.cc:188:15: [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. int err = readlink(link_from, result_payload); data/fstransform-0.9.4/fsmove/src/io/util_posix.cc:83:11: [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(path, (char * const *)argv); data/fstransform-0.9.4/fsremap/src/copy.cc:50:14: [4] (format) snprintf: 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. int delta = snprintf(buf, maxlen, "%" FT_XLL, src); data/fstransform-0.9.4/fsremap/src/copy.cc:57:2: [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. sscanf(src.c_str(), "%" FT_XLL, &dst); data/fstransform-0.9.4/fsremap/src/copy.cc:73:14: [4] (format) snprintf: 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. int delta = snprintf(buf, maxlen, "%" FT_XLL, src); data/fstransform-0.9.4/fsremap/src/io/util_posix.cc:321:11: [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(path, (char * const *)argv); data/fstransform-0.9.4/fsremap/src/job.cc:104:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(& this_dir[len], "%" FT_ULL , (ft_ull) i); data/fstransform-0.9.4/fsremap/src/log.cc:172:5: [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. vfprintf(stream, event.fmt, vargs); data/fstransform-0.9.4/fsremap/src/log.cc:177:9: [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(stream, is_reported ? " (caused by previous error: %s)%s" : ": %s%s", data/fstransform-0.9.4/fsremap/src/unsorted_map.cc:50:14: [4] (format) snprintf: 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. int delta = snprintf(buf, maxlen, "%" FT_XLL, src); data/fstransform-0.9.4/fsremap/src/unsorted_map.cc:57:2: [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. sscanf(src.c_str(), "%" FT_XLL, &dst); data/fstransform-0.9.4/fsremap/src/unsorted_map.cc:73:14: [4] (format) snprintf: 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. int delta = snprintf(buf, maxlen, "%" FT_XLL, src); data/fstransform-0.9.4/fsremap/src/misc.cc:141:36: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. # define ff_misc_random_init(seed) srandom(seed) data/fstransform-0.9.4/fsremap/src/misc.cc:142:36: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. # define ff_misc_random() random() data/fstransform-0.9.4/fsremap/src/misc.cc:145:36: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. # define ff_misc_random_init(seed) srand(seed) data/fstransform-0.9.4/fsmove/src/io/io.cc:85:12: [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). int fm_io::open(const fm_args & args) data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:111:18: [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). int fm_io_posix::open(const fm_args & args) data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:115:32: [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 ((err = super_type::open(args)) != 0) data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:307: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). if ((err = source_dir.open(source_path))) data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:413:13: [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 link_to[PATH_MAX+1]; data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:509:19: [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). int in_fd = ::open(source, O_RDWR); data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:516:20: [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). int out_fd = ::open(target, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600); data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:653: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 buf[FT_BUFSIZE]; data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:722: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 buf[FT_BUFSIZE]; data/fstransform-0.9.4/fsmove/src/io/io_prealloc.cc:67:21: [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). int fm_io_prealloc::open(const fm_args & args) data/fstransform-0.9.4/fsmove/src/io/io_prealloc.cc:69: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). int err = super_type::open(args); data/fstransform-0.9.4/fsmove/src/io/io_prealloc.cc:125:20: [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). int out_fd = ::open(target, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600); data/fstransform-0.9.4/fsmove/src/io/util_posix.cc:73:26: [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). int dev_null = ::open("/dev/null", O_RDWR); data/fstransform-0.9.4/fsmove/src/move.cc:317:72: [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). ft_log_level logger_level = equal ? (ft_log_level) atoi(equal+1) : FC_INFO; data/fstransform-0.9.4/fsmove/src/move.cc:458: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). if ((err = io->open(args)) == 0) data/fstransform-0.9.4/fsmove/src/rope/rope_impl.cc:77: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(ths->suffix(), suffix, suffix_length); data/fstransform-0.9.4/fsmove/src/rope/rope_impl.cc:96: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(dst, suffix, suffix_length); data/fstransform-0.9.4/fsmove/src/rope/rope_impl.cc:99: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(dst -= prefix_len, prefix->suffix(), prefix_len); data/fstransform-0.9.4/fsmove/src/rope/rope_impl.cc:173: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(end_dst -= p->suffix_len, p->suffix(), p->suffix_len); data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:69: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). if (dir.open(path) != 0) { data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:97: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). if (dir.open(path) != 0) { data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:130: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). if (dir.open(path) != 0) { data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:158: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). if (dir.open(path) != 0) { data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:186: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). if (dir.open(path) != 0) { data/fstransform-0.9.4/fsremap/src/arch/mem_linux.cc:58:16: [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). FILE * f = fopen("/proc/meminfo", "r"); data/fstransform-0.9.4/fsremap/src/arch/mem_linux.cc:63: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 label[256], unit[8]; data/fstransform-0.9.4/fsremap/src/io/extent_file.cc:53: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 header[200]; data/fstransform-0.9.4/fsremap/src/io/extent_posix.cc:219: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 buf[K_SIZEOF_FIEMAP]; data/fstransform-0.9.4/fsremap/src/io/io.cc:78:12: [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). int fr_io::open(const fr_args & args) data/fstransform-0.9.4/fsremap/src/io/io.cc:176:18: [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). if ((f = fopen(path_cstr, "r")) == NULL) { data/fstransform-0.9.4/fsremap/src/io/io.cc:216:18: [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). if ((f = fopen(path_cstr, "w")) == NULL) { data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:167:20: [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). dev_fd = ::open(path, O_RDWR); data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:213:19: [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[i] = ::open(path, O_RDWR); data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:217:23: [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[i] = ::open(path, O_RDONLY); data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:326:18: [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). int fr_io_posix::open(const fr_args & args) data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:333:27: [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). int err = super_type::open(args); data/fstransform-0.9.4/fsremap/src/io/io_posix.cc:814: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). if ((fd[j] = ::open(path, replaying ? O_RDWR : O_RDWR|O_CREAT|O_TRUNC, 0600)) < 0) { data/fstransform-0.9.4/fsremap/src/io/io_posix_dir.cc:59:22: [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). int ft_io_posix_dir::open(const ft_string & path) data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:101:21: [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). int fr_io_prealloc::open(const fr_args & args) data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:103:27: [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). int err = super_type::open(args); data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:133:39: [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 ((err = mount_point[i].open(path)) != 0) data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:484:32: [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 ((err = src_dir.open(src_file)) == 0) { data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:547:15: [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. const char * const path[N] = { src_path, dst_path }; data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:552:25: [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(path[i], O_RDONLY)) < 0) { data/fstransform-0.9.4/fsremap/src/io/io_self_test.cc:55:22: [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). int fr_io_self_test::open(const fr_args & args) data/fstransform-0.9.4/fsremap/src/io/io_self_test.cc:66:22: [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). int err = fr_io::open(args); data/fstransform-0.9.4/fsremap/src/io/io_test.cc:65:17: [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). int fr_io_test::open(const fr_args & args) data/fstransform-0.9.4/fsremap/src/io/io_test.cc:72:22: [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). int err = fr_io::open(args); data/fstransform-0.9.4/fsremap/src/io/io_test.cc:86:21: [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). if ((this_f[i] = fopen(io_args[i], "r")) == NULL) { data/fstransform-0.9.4/fsremap/src/io/persist.cc:63:17: [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). int fr_persist::open() data/fstransform-0.9.4/fsremap/src/io/persist.cc:80:30: [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). if ((this_persist_file = fopen(persist_path, "a+")) == NULL) data/fstransform-0.9.4/fsremap/src/io/persist.cc:94: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 line[FT_LINE_LEN + 1] = { '\0' }; data/fstransform-0.9.4/fsremap/src/io/util_posix.cc:293: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 zero[zero_len]; data/fstransform-0.9.4/fsremap/src/job.cc:152:26: [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). if ((this_log_file = fopen(log_file, "a")) == NULL) data/fstransform-0.9.4/fsremap/src/log.cc:60: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 const* const this_log_label[FC_FATAL+1] = data/fstransform-0.9.4/fsremap/src/log.cc:65: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 const* const this_log_label_always[FC_FATAL+1] = data/fstransform-0.9.4/fsremap/src/log.cc:71: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 const* const this_log_color_ansi[FC_FATAL+1] = data/fstransform-0.9.4/fsremap/src/log.cc:492: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 this_str_now[FC_SIZEOF_STR_NOW]; data/fstransform-0.9.4/fsremap/src/main.cc:203:21: [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(path, O_RDONLY)) < 0) { data/fstransform-0.9.4/fsremap/src/remap.cc:433:64: [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). ft_log_level logger_level = (ft_log_level) atoi(opt_arg); data/fstransform-0.9.4/fsremap/src/remap.cc:607:29: [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 ((err = persist->open()) != 0) { data/fstransform-0.9.4/fsremap/src/remap.cc:723: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). if ((err = io->open(args)) == 0) data/fstransform-0.9.4/fsremap/src/tmp_zero.cc:82:25: [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 ((dev_fd = ::open(args[0], O_RDWR)) < 0) { data/fstransform-0.9.4/fsremap/src/tmp_zero.cc:93:18: [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). if ((f = fopen(args[1], "r")) == NULL) { data/fstransform-0.9.4/fsremap/src/tmp_zero.cc:118: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 zero_buf[ZERO_BUF_LEN]; data/fstransform-0.9.4/fsremap/src/ui/ui_tty.cc:80:21: [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(tty_name, O_WRONLY|O_NOCTTY)) < 0) { data/fstransform-0.9.4/fstransform/src/transform.cc:276:57: [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). ft_log_level logger_level = equal ? (ft_log_level) atoi(equal+1) : FC_INFO; data/fstransform-0.9.4/fsmount_kernel/src/main.cc:118: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). len = sep ? sep - src : strlen(src); data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:268:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/fstransform-0.9.4/fsmove/src/io/io_posix.cc:868:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((got = ::read(in_fd, data, len)) == (ft_size)-1 && errno == EINTR) data/fstransform-0.9.4/fsmove/src/move.cc:316:49: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ft_mstring logger_name(arg, equal ? equal - arg : strlen(arg)); data/fstransform-0.9.4/fsmove/src/move.cc:316: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). ft_mstring logger_name(arg, equal ? equal - arg : strlen(arg)); data/fstransform-0.9.4/fsmove/src/move.cc:317:49: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ft_log_level logger_level = equal ? (ft_log_level) atoi(equal+1) : FC_INFO; data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:217:3: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(stdin); data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:223:3: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(stdin); data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:229:3: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(stdin); data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:235:3: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(stdin); data/fstransform-0.9.4/fsmove/src/rope/rope_test.cc:241:3: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(stdin); data/fstransform-0.9.4/fsremap/src/arch/mem_linux.cc:70:20: [1] (buffer) fscanf: 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. if ((err = fscanf(f, "%256s %" FT_ULL " %8s\n", label, & n_ull, unit)) <= 0) { data/fstransform-0.9.4/fsremap/src/io/io_prealloc.cc:448: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). namelen = strlen(name = entry->d_name); data/fstransform-0.9.4/fsremap/src/io/persist.cc:100: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). ft_size line_len = strlen(line); data/fstransform-0.9.4/fsremap/src/io/persist.cc:148:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int err = read(persist_size1, persist_size2); data/fstransform-0.9.4/fsremap/src/io/persist.cc:187:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int fr_persist::read(ft_ull & progress1, ft_ull & progress2) data/fstransform-0.9.4/fsremap/src/io/util_posix.cc:236:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((got = ::read(fd, mem, (size_t)chunk)) < 0 && errno == EINTR) data/fstransform-0.9.4/fsremap/src/job.cc:105:31: [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). this_dir.resize(len + strlen(& this_dir[len])); data/fstransform-0.9.4/fsremap/src/remap.cc:254:12: [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 strlen(haystack); data/fstransform-0.9.4/fstransform/src/transform.cc:275:34: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ft_mstring logger_name(arg, equal ? equal - arg : strlen(arg)); data/fstransform-0.9.4/fstransform/src/transform.cc:275:56: [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). ft_mstring logger_name(arg, equal ? equal - arg : strlen(arg)); data/fstransform-0.9.4/fstransform/src/transform.cc:276:34: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. ft_log_level logger_level = equal ? (ft_log_level) atoi(equal+1) : FC_INFO; ANALYSIS SUMMARY: Hits = 110 Lines analyzed = 12349 in approximately 0.37 seconds (33715 lines/second) Physical Source Lines of Code (SLOC) = 7849 Hits@level = [0] 15 [1] 22 [2] 67 [3] 3 [4] 11 [5] 7 Hits@level+ = [0+] 125 [1+] 110 [2+] 88 [3+] 21 [4+] 18 [5+] 7 Hits/KSLOC@level+ = [0+] 15.9256 [1+] 14.0145 [2+] 11.2116 [3+] 2.6755 [4+] 2.29329 [5+] 0.891833 Symlinks skipped = 16 (--allowlink overrides but see doc for security issue) Dot directories skipped = 6 (--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.