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/lxcfs-4.0.5/src/proc_fuse.h Examining data/lxcfs-4.0.5/src/proc_loadavg.c Examining data/lxcfs-4.0.5/src/bindings.h Examining data/lxcfs-4.0.5/src/utils.h Examining data/lxcfs-4.0.5/src/cgroup_fuse.c Examining data/lxcfs-4.0.5/src/cgroups/cgfsng.c Examining data/lxcfs-4.0.5/src/cgroups/cgroup.h Examining data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.c Examining data/lxcfs-4.0.5/src/cgroups/cgroup_utils.h Examining data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.h Examining data/lxcfs-4.0.5/src/cgroups/cgroup.c Examining data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c Examining data/lxcfs-4.0.5/src/proc_cpuview.c Examining data/lxcfs-4.0.5/src/macro.h Examining data/lxcfs-4.0.5/src/sysfs_fuse.c Examining data/lxcfs-4.0.5/src/cpuset_parse.h Examining data/lxcfs-4.0.5/src/utils.c Examining data/lxcfs-4.0.5/src/cgroup_fuse.h Examining data/lxcfs-4.0.5/src/bindings.c Examining data/lxcfs-4.0.5/src/syscall_numbers.h Examining data/lxcfs-4.0.5/src/proc_fuse.c Examining data/lxcfs-4.0.5/src/proc_loadavg.h Examining data/lxcfs-4.0.5/src/lxcfs.c Examining data/lxcfs-4.0.5/src/api_extensions.h Examining data/lxcfs-4.0.5/src/memory_utils.h Examining data/lxcfs-4.0.5/src/sysfs_fuse.h Examining data/lxcfs-4.0.5/src/cpuset_parse.c Examining data/lxcfs-4.0.5/src/proc_cpuview.h Examining data/lxcfs-4.0.5/tests/cpusetrange.c Examining data/lxcfs-4.0.5/tests/test-read.c Examining data/lxcfs-4.0.5/tests/test_syscalls.c FINAL RESULTS: data/lxcfs-4.0.5/tests/test_syscalls.c:256:6: [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. if (readlink(path, dest, 2 * strlen(path)) >= 0) { data/lxcfs-4.0.5/tests/test_syscalls.c:268:6: [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(path, 0755) == 0) { data/lxcfs-4.0.5/tests/test_syscalls.c:280:6: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(path, 0, 0) == 0) { data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.c:239:40: [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. access_mask = bpf_access_mask(device->access); data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.h:101:22: [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. const char *access, int allow) data/lxcfs-4.0.5/src/macro.h:53:3: [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, format "\n", ##__VA_ARGS__); \ data/lxcfs-4.0.5/src/macro.h:119:3: [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, format, ##__VA_ARGS__); \ data/lxcfs-4.0.5/src/proc_cpuview.c:107:42: [4] (shell) system: 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. new_usage[i].system = node->usage[i].system; data/lxcfs-4.0.5/src/proc_cpuview.c:111:40: [4] (shell) system: 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. new_view[i].system = node->view[i].system; data/lxcfs-4.0.5/src/proc_cpuview.c:351:48: [4] (shell) system: 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. free_space = threshold - usage->user - usage->system; data/lxcfs-4.0.5/src/proc_cpuview.c:386:16: [4] (shell) system: 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. if (newer[i].system > older[i].system) data/lxcfs-4.0.5/src/proc_cpuview.c:386:34: [4] (shell) system: 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. if (newer[i].system > older[i].system) data/lxcfs-4.0.5/src/proc_cpuview.c:387:48: [4] (shell) system: 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. diff[i].system = newer[i].system - older[i].system; data/lxcfs-4.0.5/src/proc_cpuview.c:397:18: [4] (shell) system: 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. sum += diff[i].system; data/lxcfs-4.0.5/src/proc_cpuview.c:428:9: [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. return sscanf(str, first ? "%" PRId64 : "%*d %" PRId64, value) == 1; data/lxcfs-4.0.5/src/proc_cpuview.c:572:8: [4] (shell) system: 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. &system, data/lxcfs-4.0.5/src/proc_cpuview.c:584:62: [4] (shell) system: 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. cg_used = cg_cpu_usage[curcpu].user + cg_cpu_usage[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:634:51: [4] (shell) system: 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. stat_node->usage[curcpu].system += diff[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:639:36: [4] (shell) system: 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. system_surplus += diff[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:664:41: [4] (shell) system: 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. if (diff[curcpu].user + diff[curcpu].system >= threshold) data/lxcfs-4.0.5/src/proc_cpuview.c:671:41: [4] (shell) system: 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. if (diff[curcpu].user + diff[curcpu].system >= threshold) data/lxcfs-4.0.5/src/proc_cpuview.c:676:25: [4] (shell) system: 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. &diff[curcpu].system, threshold); data/lxcfs-4.0.5/src/proc_cpuview.c:694:52: [4] (shell) system: 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. stat_node->view[curcpu].system += diff[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:698:43: [4] (shell) system: 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. system_sum += stat_node->view[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:702:33: [4] (shell) system: 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. diff_system += diff[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:709:118: [4] (shell) system: 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. lxcfs_v("curcpu: %d, diff_user: %lu, diff_system: %lu, diff_idle: %lu\n", curcpu, diff[curcpu].user, diff[curcpu].system, diff[curcpu].idle); data/lxcfs-4.0.5/src/proc_cpuview.c:741:63: [4] (shell) system: 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. stat_node->view[curcpu].system = stat_node->usage[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:745:43: [4] (shell) system: 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. system_sum += stat_node->view[curcpu].system; data/lxcfs-4.0.5/src/proc_cpuview.c:778:33: [4] (shell) system: 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. stat_node->view[curcpu].system, data/lxcfs-4.0.5/src/proc_cpuview.h:26:11: [4] (shell) system: 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. uint64_t system; data/lxcfs-4.0.5/src/proc_fuse.c:184:36: [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 (strcmp(path, "/proc") == 0 && access(path, R_OK) == 0) data/lxcfs-4.0.5/src/proc_fuse.c:587:8: [4] (buffer) fscanf: 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. ret = fscanf(f, "%*d " /* (1) pid %d */ data/lxcfs-4.0.5/src/proc_fuse.c:841:8: [4] (shell) system: 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. &system, data/lxcfs-4.0.5/src/proc_fuse.c:873:65: [4] (shell) system: 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. cg_used = cg_cpu_usage[physcpu].user + cg_cpu_usage[physcpu].system; data/lxcfs-4.0.5/src/proc_fuse.c:887:32: [4] (shell) system: 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. cg_cpu_usage[physcpu].system, new_idle); data/lxcfs-4.0.5/src/proc_fuse.c:898:40: [4] (shell) system: 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. system_sum += cg_cpu_usage[physcpu].system; data/lxcfs-4.0.5/src/proc_fuse.c:903:18: [4] (shell) system: 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. system_sum += system; data/lxcfs-4.0.5/src/proc_fuse.c:971:4: [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(line, "hierarchical_memory_limit %" PRIu64, &(mstat->hierarchical_memory_limit)); data/lxcfs-4.0.5/src/proc_fuse.c:973:4: [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(line, "hierarchical_memsw_limit %" PRIu64, &(mstat->hierarchical_memsw_limit)); data/lxcfs-4.0.5/src/proc_fuse.c:975:4: [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(line, unified ? "file %" PRIu64 : "total_cache %" PRIu64, &(mstat->total_cache)); data/lxcfs-4.0.5/src/proc_fuse.c:977:4: [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(line, "total_rss %" PRIu64, &(mstat->total_rss)); data/lxcfs-4.0.5/src/proc_fuse.c:979:4: [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(line, "total_rss_huge %" PRIu64, &(mstat->total_rss_huge)); data/lxcfs-4.0.5/src/proc_fuse.c:981:4: [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(line, unified ? "shmem %" PRIu64 : "total_shmem %" PRIu64, &(mstat->total_shmem)); data/lxcfs-4.0.5/src/proc_fuse.c:983:4: [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(line, unified ? "file_mapped %" PRIu64 : "total_mapped_file %" PRIu64, &(mstat->total_mapped_file)); data/lxcfs-4.0.5/src/proc_fuse.c:985:4: [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(line, "total_dirty %" PRIu64, &(mstat->total_dirty)); data/lxcfs-4.0.5/src/proc_fuse.c:987:4: [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(line, "total_writeback %" PRIu64, &(mstat->total_writeback)); data/lxcfs-4.0.5/src/proc_fuse.c:989:4: [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(line, "total_swap %" PRIu64, &(mstat->total_swap)); data/lxcfs-4.0.5/src/proc_fuse.c:991:4: [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(line, "total_pgpgin %" PRIu64, &(mstat->total_pgpgin)); data/lxcfs-4.0.5/src/proc_fuse.c:993:4: [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(line, "total_pgpgout %" PRIu64, &(mstat->total_pgpgout)); data/lxcfs-4.0.5/src/proc_fuse.c:995:4: [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(line, unified ? "pgfault %" PRIu64 : "total_pgfault %" PRIu64, &(mstat->total_pgfault)); data/lxcfs-4.0.5/src/proc_fuse.c:997:4: [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(line, unified ? "pgmajfault %" PRIu64 : "total_pgmajfault %" PRIu64, &(mstat->total_pgmajfault)); data/lxcfs-4.0.5/src/proc_fuse.c:999:4: [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(line, unified ? "inactive_anon %" PRIu64 : "total_inactive_anon %" PRIu64, &(mstat->total_inactive_anon)); data/lxcfs-4.0.5/src/proc_fuse.c:1001:4: [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(line, unified ? "active_anon %" PRIu64 : "total_active_anon %" PRIu64, &(mstat->total_active_anon)); data/lxcfs-4.0.5/src/proc_fuse.c:1003:4: [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(line, unified ? "inactive_file %" PRIu64 : "total_inactive_file %" PRIu64, &(mstat->total_inactive_file)); data/lxcfs-4.0.5/src/proc_fuse.c:1005:4: [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(line, unified ? "active_file %" PRIu64 : "total_active_file %" PRIu64, &(mstat->total_active_file)); data/lxcfs-4.0.5/src/proc_fuse.c:1007:4: [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(line, unified ? "unevictable %" PRIu64 : "total_unevictable %" PRIu64, &(mstat->total_unevictable)); data/lxcfs-4.0.5/src/proc_fuse.c:1105:4: [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(line+sizeof("MemTotal:")-1, "%" PRIu64, &hosttotal); data/lxcfs-4.0.5/src/proc_fuse.c:1123:5: [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(line + STRLITERALLEN("SwapTotal:"), "%" PRIu64, &hostswtotal); data/lxcfs-4.0.5/src/proc_fuse.c:1138:6: [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(line + STRLITERALLEN("SwapFree:"), "%" PRIu64, &hostswfree); data/lxcfs-4.0.5/src/sysfs_fuse.c:261:35: [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 (strcmp(path, "/sys") == 0 && access(path, R_OK) == 0) data/lxcfs-4.0.5/src/sysfs_fuse.c:264:43: [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 (strcmp(path, "/sys/devices") == 0 && access(path, R_OK) == 0) data/lxcfs-4.0.5/src/sysfs_fuse.c:267:50: [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 (strcmp(path, "/sys/devices/system") == 0 && access(path, R_OK) == 0) data/lxcfs-4.0.5/src/sysfs_fuse.c:271: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. access(path, R_OK) == 0) data/lxcfs-4.0.5/src/utils.c:60:11: [4] (format) vsnprintf: 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. tmplen = vsnprintf(tmp, BUF_RESERVE_SIZE, format, args); data/lxcfs-4.0.5/tests/test_syscalls.c:60: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, O_RDONLY) >= 0) { data/lxcfs-4.0.5/src/bindings.c:655:6: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(".") < 0) { data/lxcfs-4.0.5/tests/test_syscalls.c:316:6: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(path) == 0) { data/lxcfs-4.0.5/src/bindings.c:167: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 path[LXCFS_PROC_PID_LEN]; data/lxcfs-4.0.5/src/bindings.c:284: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 path[LXCFS_PROC_PID_LEN]; data/lxcfs-4.0.5/src/bindings.c:441: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 path[LXCFS_PROC_PID_NS_LEN]; data/lxcfs-4.0.5/src/bindings.c:445: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 | O_CLOEXEC); data/lxcfs-4.0.5/src/bindings.c:511: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 path[LXCFS_PROC_PID_NS_LEN]; data/lxcfs-4.0.5/src/bindings.c:609: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). oldroot = open("/", O_DIRECTORY | O_RDONLY | O_CLOEXEC); data/lxcfs-4.0.5/src/bindings.c:614: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). newroot = open(ROOTDIR, O_DIRECTORY | O_RDONLY | O_CLOEXEC); data/lxcfs-4.0.5/src/bindings.c:777:14: [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). (*h)->fd = open(path, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW); data/lxcfs-4.0.5/src/bindings.c:898: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). root_fd = open("/", O_PATH | O_CLOEXEC); data/lxcfs-4.0.5/src/cgroup_fuse.c:357: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[400]; data/lxcfs-4.0.5/src/cgroup_fuse.c:401: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 fpath[PROCLEN]; data/lxcfs-4.0.5/src/cgroup_fuse.c:420:12: [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(fpath, "re"); data/lxcfs-4.0.5/src/cgroup_fuse.c:631: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 path[MAXPATHLEN]; data/lxcfs-4.0.5/src/cgroup_fuse.c:753: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 pathname[MAXPATHLEN]; data/lxcfs-4.0.5/src/cgroup_fuse.c:1208: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 fnam[100]; data/lxcfs-4.0.5/src/cgroup_fuse.c:1215: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). newnsfd = open(fnam, O_RDONLY); data/lxcfs-4.0.5/src/cgroup_fuse.c:1408: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(buf, data, s); data/lxcfs-4.0.5/src/cgroup_fuse.c:1545: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 fnam[100]; data/lxcfs-4.0.5/src/cgroup_fuse.c:1552: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). newnsfd = open(fnam, O_RDONLY); data/lxcfs-4.0.5/src/cgroup_fuse.c:1593: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[400]; data/lxcfs-4.0.5/src/cgroup_fuse.c:1600:2: [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(line, "/proc/%d/status", pid); data/lxcfs-4.0.5/src/cgroup_fuse.c:1601:11: [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(line, "re")) == NULL) { data/lxcfs-4.0.5/src/cgroup_fuse.c:1632: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[400]; data/lxcfs-4.0.5/src/cgroup_fuse.c:1634:2: [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(line, "/proc/%d/uid_map", pid); data/lxcfs-4.0.5/src/cgroup_fuse.c:1635:11: [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(line, "re")) == NULL) { data/lxcfs-4.0.5/src/cgroup_fuse.c:1799: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(localbuf, buf, size); data/lxcfs-4.0.5/src/cgroup_fuse.c:1857: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 pathname[MAXPATHLEN]; data/lxcfs-4.0.5/src/cgroups/cgfsng.c:95: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(prefixed, "name=", STRLITERALLEN("name=")); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:96: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(prefixed + STRLITERALLEN("name="), entry, len); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:336: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(sret, p, len); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:357:6: [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). f = fopen("/proc/self/cgroup", "re"); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:959: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). ops->cgroup2_root_fd = open(DEFAULT_CGROUP_MOUNTPOINT, O_DIRECTORY | O_PATH | O_CLOEXEC); data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.c:49: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(prog->instructions + prog->n_instructions, instructions, data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.c:377: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_DIRECTORY | O_RDONLY | O_CLOEXEC); data/lxcfs-4.0.5/src/cgroups/cgroup2_devices.c:411: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(prog->attached_path, O_DIRECTORY | O_RDONLY | O_CLOEXEC); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:125: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(dest + cur_len, "/", 1); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:129: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(dest + cur_len, cur, buf_len); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:369: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). dirfd = open(prefix_skip, O_RDONLY); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:405: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 srcbuf[50], destbuf[50]; data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:446: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(dest, src, len); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:496: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, open_mode, 0660); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:519: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(sret, p, len); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:540: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(*dest + oldlen, new, newlen + 1); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:560:6: [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). f = fopen(fnam, "re"); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:584: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 path[STRLITERALLEN("/proc//cgroup") + INTTYPE_TO_STRLEN(pid_t) + 1]; data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:615: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(tmp, cgline, len); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:662: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 path[STRLITERALLEN("/proc//cgroup") + INTTYPE_TO_STRLEN(pid_t) + 1]; data/lxcfs-4.0.5/src/lxcfs.c:119: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 lxcfs_lib_path[PATH_MAX]; data/lxcfs-4.0.5/src/lxcfs.c:1033: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[INTTYPE_TO_STRLEN(long)]; data/lxcfs-4.0.5/src/lxcfs.c:1042: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(pidfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | O_CLOEXEC); data/lxcfs-4.0.5/src/lxcfs.c:1070: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 pidfile_buf[STRLITERALLEN(RUNTIME_PATH) + STRLITERALLEN("/lxcfs.pid") + 1] = {}; data/lxcfs-4.0.5/src/lxcfs.c:1078: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 *newargv[6]; data/lxcfs-4.0.5/src/memory_utils.h:81:16: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return copy ? memcpy(copy, data, len) : NULL; data/lxcfs-4.0.5/src/proc_cpuview.c:79: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(node->usage, usage, sizeof(struct cpuacct_usage) * cpu_count); data/lxcfs-4.0.5/src/proc_cpuview.c:412: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 file[STRLITERALLEN("cpu.cfs_period_us") + 1]; data/lxcfs-4.0.5/src/proc_cpuview.c:534: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 cpu_char[10]; /* That's a lot of cores */ data/lxcfs-4.0.5/src/proc_cpuview.c:867: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/proc_cpuview.c:1006: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:132:6: [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). f = fopen(path, "re"); data/lxcfs-4.0.5/src/proc_fuse.c:270: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:348: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:357: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 key[32]; data/lxcfs-4.0.5/src/proc_fuse.c:400: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 dev_name[72]; data/lxcfs-4.0.5/src/proc_fuse.c:413: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:463: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 lbuf[256]; data/lxcfs-4.0.5/src/proc_fuse.c:516: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:566: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 path[STRLITERALLEN("/proc/") + LXCFS_NUMSTRLEN64 + data/lxcfs-4.0.5/src/proc_fuse.c:691: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:715: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:739: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 cpuall[CPUALL_MAX_SIZE]; data/lxcfs-4.0.5/src/proc_fuse.c:756: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(buf, d->buf + offset, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:808: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 cpu_char[10]; /* That's a lot of cores */ data/lxcfs-4.0.5/src/proc_fuse.c:928: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(cache, cpuall, cpuall_len); data/lxcfs-4.0.5/src/proc_fuse.c:945: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:1044: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/proc_fuse.c:1101: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 *printme, lbuf[100]; data/lxcfs-4.0.5/src/proc_fuse.c:1249: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_loadavg.c:191: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(buf, d->buf + offset, total_len); data/lxcfs-4.0.5/src/proc_loadavg.c:262: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/proc_loadavg.c:368: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 proc_path[STRLITERALLEN("/proc//task//status") + data/lxcfs-4.0.5/src/proc_loadavg.c:426:8: [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). f = fopen(proc_path, "re"); data/lxcfs-4.0.5/src/sysfs_fuse.c:74: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/sysfs_fuse.c:116: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/sysfs_fuse.c:128:6: [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). f = fopen(which, "re"); data/lxcfs-4.0.5/src/utils.c:55: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 tmp[BUF_RESERVE_SIZE]; data/lxcfs-4.0.5/src/utils.c:71: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((*src) +*sz , tmp, tmplen+1); /* include the \0 */ data/lxcfs-4.0.5/src/utils.c:144: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 path[__NS_PATH_LEN]; data/lxcfs-4.0.5/src/utils.c:158:9: [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). return open(path, O_RDONLY | O_CLOEXEC); data/lxcfs-4.0.5/src/utils.c:222: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 cmsgbuf[CMSG_SPACE(sizeof(*cred))] = {}; data/lxcfs-4.0.5/src/utils.c:258: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(cred, CMSG_DATA(cmsg), sizeof(*cred)); data/lxcfs-4.0.5/src/utils.c:278: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 cmsgbuf[CMSG_SPACE(sizeof(*cred))]; data/lxcfs-4.0.5/src/utils.c:279: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[1]; data/lxcfs-4.0.5/src/utils.c:293: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(CMSG_DATA(cmsg), cred, sizeof(*cred)); data/lxcfs-4.0.5/src/utils.c:322:6: [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). f = fopen(path, "re"); data/lxcfs-4.0.5/src/utils.c:343: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(buf, d->buf, total_len); data/lxcfs-4.0.5/src/utils.c:367: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(buf, cache + offset, total_len); data/lxcfs-4.0.5/src/utils.c:446: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 buf[4096]; data/lxcfs-4.0.5/src/utils.c:457: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(copy + *length, buf, bytes_read); data/lxcfs-4.0.5/src/utils.c:471: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 | O_CLOEXEC); data/lxcfs-4.0.5/tests/test-read.c:23:1: [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[BUFSIZE]; data/lxcfs-4.0.5/tests/test-read.c:33:15: [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). read_count = atoi(argv[2]); data/lxcfs-4.0.5/tests/test-read.c:36: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). fd = open(file, O_RDONLY|O_DIRECT); data/lxcfs-4.0.5/tests/test-read.c:38: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). fd = open(file, O_RDONLY); data/lxcfs-4.0.5/tests/test_syscalls.c:34:11: [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 fd = open(path, O_RDONLY); data/lxcfs-4.0.5/tests/test_syscalls.c:339: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 value[200]; data/lxcfs-4.0.5/tests/test_syscalls.c:372: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(d, O_RDONLY); data/lxcfs-4.0.5/src/cgroup_fuse.c:98:6: [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 (strlen(path) < 9) { data/lxcfs-4.0.5/src/cgroup_fuse.c:132:6: [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 (strlen(path) < 9) { data/lxcfs-4.0.5/src/cgroup_fuse.c:202: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). target_len = strlen(cg); data/lxcfs-4.0.5/src/cgroup_fuse.c:203: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). task_len = strlen(task_cg); data/lxcfs-4.0.5/src/cgroup_fuse.c:244:6: [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 (strlen(taskcg) <= strlen(querycg)) { data/lxcfs-4.0.5/src/cgroup_fuse.c:244: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 (strlen(taskcg) <= strlen(querycg)) { data/lxcfs-4.0.5/src/cgroup_fuse.c:252: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). start = strdup(taskcg + strlen(querycg) + 1); data/lxcfs-4.0.5/src/cgroup_fuse.c:292: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). if (strncmp(linecmp, cg, strlen(linecmp)) != 0) { data/lxcfs-4.0.5/src/cgroup_fuse.c:636: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). len = strlen(dirname); data/lxcfs-4.0.5/src/cgroup_fuse.c:1239:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(cpipe[0], &v, 1); data/lxcfs-4.0.5/src/cgroup_fuse.c:1316:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sock[0], &qpid, sizeof(qpid)) != sizeof(qpid)) { data/lxcfs-4.0.5/src/cgroup_fuse.c:1405:6: [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). s = strlen(data); data/lxcfs-4.0.5/src/cgroup_fuse.c:1524:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ret = read(sock, &vpid, sizeof(pid_t))) != sizeof(pid_t)) { data/lxcfs-4.0.5/src/cgroup_fuse.c:1577:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(cpipe[0], &v, 1); data/lxcfs-4.0.5/src/cgroup_fuse.c:1770: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). len = strlen(value); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:92: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). len = strlen(entry); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:334: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). len = strlen(p); data/lxcfs-4.0.5/src/cgroups/cgfsng.c:399: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). len = strlen(s); data/lxcfs-4.0.5/src/cgroups/cgroup.c:93: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). point = cg + strlen(cg) - strlen(INIT_SCOPE); data/lxcfs-4.0.5/src/cgroups/cgroup.c:93:28: [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). point = cg + strlen(cg) - strlen(INIT_SCOPE); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:107: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). size_t full_len = strlen(first); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:116: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). buf_len = strlen(cur); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:161: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). size_t sep_len = strlen(sep); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:167: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). result_len += (p > (char **)parts) * sep_len + strlen(*p); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:248: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). size_t subdirlen = strlen(subdir); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:339: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). fulllen = strlen(target); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:342: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). if (prefix_skip && strlen(prefix_skip) > 0) { data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:343: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). curlen = strlen(prefix_skip); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:442: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). size_t ret = strlen(src); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:459:14: [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 l + strlen(s); data/lxcfs-4.0.5/src/cgroups/cgroup_utils.c:547: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). for (l = strlen(s); l > 0 && s[l - 1] == '\n'; l--) data/lxcfs-4.0.5/src/proc_cpuview.c:537:7: [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 (strlen(line) == 0) data/lxcfs-4.0.5/src/proc_fuse.c:241:29: [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 strncmp(line, pref, strlen(pref)) == 0; data/lxcfs-4.0.5/src/proc_fuse.c:364: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). len = strlen(key); data/lxcfs-4.0.5/src/proc_fuse.c:465:7: [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. i = sscanf(line, "%u %u %71s", &major, &minor, dev_name); data/lxcfs-4.0.5/src/proc_fuse.c:469:62: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). get_blkio_io_value(io_serviced_str, major, minor, "Read", &read); data/lxcfs-4.0.5/src/proc_fuse.c:494:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read || write || read_merged || write_merged || read_sectors || write_sectors || read_ticks || write_ticks) data/lxcfs-4.0.5/src/proc_fuse.c:496:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). major, minor, dev_name, read, read_merged, read_sectors, read_ticks, data/lxcfs-4.0.5/src/proc_fuse.c:813:7: [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 (strlen(line) == 0) data/lxcfs-4.0.5/src/proc_loadavg.c:384: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). length = strlen(idbuf[i]) - 1; data/lxcfs-4.0.5/src/proc_loadavg.c:521: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(FLUSH_TIME * 1000000 - data/lxcfs-4.0.5/src/utils.c:379: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 cg_len = strlen(cg), initscope_len = strlen(INITSCOPE); data/lxcfs-4.0.5/src/utils.c:379:46: [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 cg_len = strlen(cg), initscope_len = strlen(INITSCOPE); data/lxcfs-4.0.5/src/utils.c:418:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, count); data/lxcfs-4.0.5/src/utils.c:581: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). buffer += char_left_gc(buffer, strlen(buffer)); data/lxcfs-4.0.5/src/utils.c:582: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). buffer[char_right_gc(buffer, strlen(buffer))] = '\0'; data/lxcfs-4.0.5/tests/test-read.c:42:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, BUFSIZE-1); data/lxcfs-4.0.5/tests/test_syscalls.c:83:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(my_addr.sun_path, path, data/lxcfs-4.0.5/tests/test_syscalls.c:125: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). size_t len = strlen(path) + 30; data/lxcfs-4.0.5/tests/test_syscalls.c:137: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). size_t len = strlen(path) + 30; data/lxcfs-4.0.5/tests/test_syscalls.c:161: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). size_t len = strlen(path) + 30; data/lxcfs-4.0.5/tests/test_syscalls.c:191: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). size_t len = strlen(path) + 30; data/lxcfs-4.0.5/tests/test_syscalls.c:230: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). size_t len = strlen(path) + 30; data/lxcfs-4.0.5/tests/test_syscalls.c:254: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 *dest = alloca(2 * strlen(path)); data/lxcfs-4.0.5/tests/test_syscalls.c:256: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). if (readlink(path, dest, 2 * strlen(path)) >= 0) { data/lxcfs-4.0.5/tests/test_syscalls.c:383: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). size_t len = strlen(path) + strlen("/cgroup.procs") + 1; data/lxcfs-4.0.5/tests/test_syscalls.c:383:30: [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 len = strlen(path) + strlen("/cgroup.procs") + 1; data/lxcfs-4.0.5/tests/test_syscalls.c:410: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). len = strlen(argv[1]) + strlen("/cgroup.procs") + 1; data/lxcfs-4.0.5/tests/test_syscalls.c:410: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). len = strlen(argv[1]) + strlen("/cgroup.procs") + 1; ANALYSIS SUMMARY: Hits = 232 Lines analyzed = 12632 in approximately 0.34 seconds (37324 lines/second) Physical Source Lines of Code (SLOC) = 9439 Hits@level = [0] 179 [1] 59 [2] 106 [3] 2 [4] 62 [5] 3 Hits@level+ = [0+] 411 [1+] 232 [2+] 173 [3+] 67 [4+] 65 [5+] 3 Hits/KSLOC@level+ = [0+] 43.5427 [1+] 24.5789 [2+] 18.3282 [3+] 7.09821 [4+] 6.88632 [5+] 0.31783 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.