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/python-psutil-5.7.3/psutil/_psutil_linux.c Examining data/python-psutil-5.7.3/psutil/_psutil_aix.c Examining data/python-psutil-5.7.3/psutil/_psutil_sunos.c Examining data/python-psutil-5.7.3/psutil/_psutil_posix.h Examining data/python-psutil-5.7.3/psutil/_psutil_osx.c Examining data/python-psutil-5.7.3/psutil/_psutil_common.c Examining data/python-psutil-5.7.3/psutil/_psutil_windows.c Examining data/python-psutil-5.7.3/psutil/_psutil_posix.c Examining data/python-psutil-5.7.3/psutil/arch/freebsd/sys_socks.h Examining data/python-psutil-5.7.3/psutil/arch/freebsd/proc_socks.c Examining data/python-psutil-5.7.3/psutil/arch/freebsd/proc_socks.h Examining data/python-psutil-5.7.3/psutil/arch/freebsd/sys_socks.c Examining data/python-psutil-5.7.3/psutil/arch/freebsd/specific.h Examining data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c Examining data/python-psutil-5.7.3/psutil/arch/solaris/v10/ifaddrs.c Examining data/python-psutil-5.7.3/psutil/arch/solaris/v10/ifaddrs.h Examining data/python-psutil-5.7.3/psutil/arch/solaris/environ.h Examining data/python-psutil-5.7.3/psutil/arch/solaris/environ.c Examining data/python-psutil-5.7.3/psutil/arch/openbsd/specific.h Examining data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c Examining data/python-psutil-5.7.3/psutil/arch/aix/ifaddrs.c Examining data/python-psutil-5.7.3/psutil/arch/aix/net_kernel_structs.h Examining data/python-psutil-5.7.3/psutil/arch/aix/net_connections.h Examining data/python-psutil-5.7.3/psutil/arch/aix/common.h Examining data/python-psutil-5.7.3/psutil/arch/aix/ifaddrs.h Examining data/python-psutil-5.7.3/psutil/arch/aix/common.c Examining data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c Examining data/python-psutil-5.7.3/psutil/arch/osx/process_info.c Examining data/python-psutil-5.7.3/psutil/arch/osx/process_info.h Examining data/python-psutil-5.7.3/psutil/arch/windows/process_handles.h Examining data/python-psutil-5.7.3/psutil/arch/windows/disk.c Examining data/python-psutil-5.7.3/psutil/arch/windows/wmi.h Examining data/python-psutil-5.7.3/psutil/arch/windows/socks.h Examining data/python-psutil-5.7.3/psutil/arch/windows/disk.h Examining data/python-psutil-5.7.3/psutil/arch/windows/services.h Examining data/python-psutil-5.7.3/psutil/arch/windows/process_info.c Examining data/python-psutil-5.7.3/psutil/arch/windows/process_info.h Examining data/python-psutil-5.7.3/psutil/arch/windows/wmi.c Examining data/python-psutil-5.7.3/psutil/arch/windows/cpu.c Examining data/python-psutil-5.7.3/psutil/arch/windows/security.h Examining data/python-psutil-5.7.3/psutil/arch/windows/net.h Examining data/python-psutil-5.7.3/psutil/arch/windows/cpu.h Examining data/python-psutil-5.7.3/psutil/arch/windows/security.c Examining data/python-psutil-5.7.3/psutil/arch/windows/socks.c Examining data/python-psutil-5.7.3/psutil/arch/windows/net.c Examining data/python-psutil-5.7.3/psutil/arch/windows/process_utils.c Examining data/python-psutil-5.7.3/psutil/arch/windows/ntextapi.h Examining data/python-psutil-5.7.3/psutil/arch/windows/process_handles.c Examining data/python-psutil-5.7.3/psutil/arch/windows/services.c Examining data/python-psutil-5.7.3/psutil/arch/windows/process_utils.h Examining data/python-psutil-5.7.3/psutil/arch/netbsd/socks.h Examining data/python-psutil-5.7.3/psutil/arch/netbsd/specific.h Examining data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c Examining data/python-psutil-5.7.3/psutil/arch/netbsd/socks.c Examining data/python-psutil-5.7.3/psutil/_psutil_common.h Examining data/python-psutil-5.7.3/psutil/_psutil_bsd.c FINAL RESULTS: data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c:141:19: [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 len = readlink(buf, path, sizeof(path) - 1); data/python-psutil-5.7.3/psutil/_psutil_aix.c:105:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/psinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_aix.c:118:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/status", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_aix.c:148:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/psinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_aix.c:398:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/status", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_aix.c:422:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/cred", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_aix.c:625:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(first.name, FIRST_NETINTERFACE); data/python-psutil-5.7.3/psutil/_psutil_aix.c:836:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(id.name, FIRST_DISK); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:205:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", kp.ki_comm); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:207:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", kp.p_comm); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:370:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", kp.ki_comm); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:372:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", kp.p_comm); data/python-psutil-5.7.3/psutil/_psutil_common.c:77:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fullmsg, "(originated from %s)", syscall); data/python-psutil-5.7.3/psutil/_psutil_common.c:81:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fullmsg, "%s (originated from %s)", strerror(errno), syscall); data/python-psutil-5.7.3/psutil/_psutil_common.c:99:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg, "No such process (originated from %s)", syscall); data/python-psutil-5.7.3/psutil/_psutil_common.c:116:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg, "Access denied (originated from %s)", syscall); data/python-psutil-5.7.3/psutil/_psutil_common.c:150:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, argptr); data/python-psutil-5.7.3/psutil/_psutil_common.c:179:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fullmsg, "(originated from %s: %s)", syscall, errbuf); data/python-psutil-5.7.3/psutil/_psutil_common.c:267:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fullmsg, "(originated from %s)", syscall); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:106:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/psinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:198:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/psinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:273:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/psinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:337:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/status", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:370:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/lpsinfo", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:436:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/cred", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:457:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/usage", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:514:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/lwp/%i/lwpstatus", procfs_path, pid, tid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:878:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/status", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:882:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%i/xmap", procfs_path, pid); data/python-psutil-5.7.3/psutil/_psutil_windows.c:802:49: [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. processHandle = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/_psutil_windows.c:984:44: [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. hProcess = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1046:44: [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. hProcess = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1145:44: [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. hProcess = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1402:44: [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. hProcess = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/arch/netbsd/socks.c:393:17: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(laddr, sun_src->sun_path); data/python-psutil-5.7.3/psutil/arch/netbsd/socks.c:394:17: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(raddr, sun_dst->sun_path); data/python-psutil-5.7.3/psutil/arch/windows/cpu.c:50: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. double idle, kernel, user, system; data/python-psutil-5.7.3/psutil/arch/windows/cpu.c:69: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. return Py_BuildValue("(ddd)", user, system, idle); data/python-psutil-5.7.3/psutil/arch/windows/process_info.c:107:44: [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. hProcess = psutil_handle_from_pid(pid, access); data/python-psutil-5.7.3/psutil/arch/windows/process_utils.c:125:41: [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. psutil_handle_from_pid(DWORD pid, DWORD access) { data/python-psutil-5.7.3/psutil/arch/windows/process_utils.c:133:28: [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. hProcess = OpenProcess(access, FALSE, pid); data/python-psutil-5.7.3/psutil/arch/windows/services.c:20:72: [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. psutil_get_service_handler(char *service_name, DWORD scm_access, DWORD access) data/python-psutil-5.7.3/psutil/arch/windows/services.c:30:46: [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. hService = OpenService(sc, service_name, access); data/python-psutil-5.7.3/psutil/arch/windows/services.h:11:48: [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. char service_name, DWORD scm_access, DWORD access); data/python-psutil-5.7.3/psutil/_psutil_common.c:162:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("PSUTIL_DEBUG") != NULL) data/python-psutil-5.7.3/psutil/_psutil_common.c:164:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("PSUTIL_TESTING") != NULL) data/python-psutil-5.7.3/psutil/_psutil_common.c:386:5: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&PSUTIL_CRITICAL_SECTION); data/python-psutil-5.7.3/psutil/arch/windows/process_handles.c:224:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&PSUTIL_CRITICAL_SECTION); data/python-psutil-5.7.3/psutil/_psutil_aix.c: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). fd = open(path, O_RDONLY); data/python-psutil-5.7.3/psutil/_psutil_aix.c:97: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 path[100]; data/python-psutil-5.7.3/psutil/_psutil_aix.c:142: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 path[100]; data/python-psutil-5.7.3/psutil/_psutil_aix.c:392: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 path[100]; data/python-psutil-5.7.3/psutil/_psutil_aix.c:416: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 path[100]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:193: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 str[1000]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:362: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 str[1000]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:402: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 *s, **envs, errbuf[_POSIX2_LINE_MAX]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:496:17: [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(errbuf, data/python-psutil-5.7.3/psutil/_psutil_bsd.c:503:17: [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(errbuf, "kvm_getenvv(pid=%ld)", pid); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:679: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 opts[200]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:885: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 ifc_name[32]; data/python-psutil-5.7.3/psutil/_psutil_bsd.c:953:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(_PATH_UTMP, "r"); data/python-psutil-5.7.3/psutil/_psutil_common.c:74: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 fullmsg[1024]; data/python-psutil-5.7.3/psutil/_psutil_common.c:97: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 msg[1024]; data/python-psutil-5.7.3/psutil/_psutil_common.c:114: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 msg[1024]; data/python-psutil-5.7.3/psutil/_psutil_common.c:177: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 fullmsg[8192]; data/python-psutil-5.7.3/psutil/_psutil_common.c:259: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 fullmsg[1024]; data/python-psutil-5.7.3/psutil/_psutil_osx.c:293: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[PATH_MAX]; data/python-psutil-5.7.3/psutil/_psutil_osx.c:749: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 opts[400]; data/python-psutil-5.7.3/psutil/_psutil_osx.c:1159: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 lip[200], rip[200]; data/python-psutil-5.7.3/psutil/_psutil_osx.c:1363: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 ifc_name[32]; data/python-psutil-5.7.3/psutil/_psutil_osx.c:1476: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 disk_name[kMaxDiskNameSize]; data/python-psutil-5.7.3/psutil/_psutil_posix.c:175: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[NI_MAXHOST]; data/python-psutil-5.7.3/psutil/_psutil_posix.c:232:13: [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(ptr, "%02x:", data[n] & 0xff); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:70: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). fd = open(path, O_RDONLY); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:99: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:167:9: [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(last, array[i], item_length); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:185: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:256: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:331: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:358: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:371: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). fd = open(path, O_RDONLY); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:430: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:451: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:508: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:698: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 = fopen(MNTTAB, "rb"); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:855: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 path[1000]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:856: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 perms[10]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:890: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). fd = open(path, O_RDONLY); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:917:9: [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(perms, "%c%c%c%c", p->pr_mflags & MA_READ ? 'r' : '-', data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1125: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[512]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1127: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 lip[INET6_ADDRSTRLEN], rip[INET6_ADDRSTRLEN]; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1147: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). sd = open("/dev/arp", O_RDWR); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1180:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, &tor, sizeof tor); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1181:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + tor.OPT_offset, &mibhdr, sizeof mibhdr); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1196:9: [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(&toa, buf, sizeof toa); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1197:9: [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(&tea, buf, sizeof tea); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1222:9: [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(&mibhdr, buf + toa.OPT_offset, toa.OPT_length); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1244:17: [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(&tp, databuf.buf + i * sizeof tp, sizeof tp); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1289:17: [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(&tp6, databuf.buf + i * sizeof tp6, sizeof tp6); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1331:17: [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(&ude, databuf.buf + i * sizeof ude, sizeof ude); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:1371:17: [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(&ude6, databuf.buf + i * sizeof ude6, sizeof ude6); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1202: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 address_str[50]; data/python-psutil-5.7.3/psutil/arch/aix/ifaddrs.c:35: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(sa2, sa1, sz); data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c:84: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 laddr_str[INET6_ADDRSTRLEN]; data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c:85: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 raddr_str[INET6_ADDRSTRLEN]; data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c:87: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 unix_laddr_str[PATH_MAX] = { 0 }; data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c:88: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 unix_raddr_str[PATH_MAX] = { 0 }; data/python-psutil-5.7.3/psutil/arch/aix/net_connections.c:226: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). Kd = open(KMEM, O_RDONLY, 0); data/python-psutil-5.7.3/psutil/arch/freebsd/proc_socks.c:230: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 lip[200], rip[200]; data/python-psutil-5.7.3/psutil/arch/freebsd/proc_socks.c:231: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 path[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:234: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 pathname[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:692: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 disk_name[128]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:736: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 addr[1000]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:737: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 perms[4]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:765:9: [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(addr, "%#*jx-%#*jx", ptrwidth, (uintmax_t)kve->kve_start, data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1018: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 sensor[26]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1023:5: [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(sensor, "dev.cpu.%d.temperature", core); data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1029:5: [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(sensor, "dev.cpu.%d.coretemp.tjmax", core); data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1054: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 sensor[26]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1055: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 available_freq_levels[1000]; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1061:5: [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(sensor, "dev.cpu.%d.freq", core); data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:1068:5: [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(sensor, "dev.cpu.%d.freq_levels", core); data/python-psutil-5.7.3/psutil/arch/freebsd/sys_socks.c:179: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 lip[200], rip[200]; data/python-psutil-5.7.3/psutil/arch/freebsd/sys_socks.c:247: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 path[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/netbsd/socks.c:302: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 laddr[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/netbsd/socks.c:303: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 raddr[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c:119: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 path[MAXPATHLEN]; data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c:313: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 errbuf[_POSIX2_LINE_MAX]; data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c:346: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(*procList, result, mlen); data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:128: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 errbuf[_POSIX2_LINE_MAX]; data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:159: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(*procList, result, mlen); data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:233: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 errbuf[4096]; data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:419: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 path[MAXPATHLEN]; data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:438: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 * data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:450:12: [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 hbuf[NI_MAXHOST]; data/python-psutil-5.7.3/psutil/arch/openbsd/specific.c:515: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 addrbuf[NI_MAXHOST + 2]; data/python-psutil-5.7.3/psutil/arch/osx/process_info.c:306:9: [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(procenv + (arg_ptr - env_start), arg_ptr, s - arg_ptr); data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:38: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 proc_path[PATH_MAX]; data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:41: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). fd = open(proc_path, O_RDONLY); data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:96: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[STRING_SEARCH_BUF_SIZE]; data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:251: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[8]; data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:252:18: [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 const char zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; data/python-psutil-5.7.3/psutil/arch/solaris/v10/ifaddrs.c:29: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(sa2,sa1,sz); data/python-psutil-5.7.3/psutil/arch/windows/disk.c:87: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 szDevice[MAX_PATH]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:88: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 szDeviceDisplay[MAX_PATH]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:196: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 drive_strings[255]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:198: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 mp_buf[MAX_PATH]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:199: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 mp_path[MAX_PATH]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:204: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 opts[20]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:356:5: [2] (buffer) TCHAR: 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. TCHAR szBuff[5]; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:362:9: [2] (buffer) TCHAR: 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. TCHAR szDeviceName[3] = {d, TEXT(':'), TEXT('\0')}; data/python-psutil-5.7.3/psutil/arch/windows/disk.c:363:9: [2] (buffer) TCHAR: 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. TCHAR szTarget[512] = {0}; data/python-psutil-5.7.3/psutil/arch/windows/net.c:143: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 buff_addr[1024]; data/python-psutil-5.7.3/psutil/arch/windows/net.c:144: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 buff_macaddr[1024]; data/python-psutil-5.7.3/psutil/arch/windows/net.c:145: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 buff_netmask[1024]; data/python-psutil-5.7.3/psutil/arch/windows/net.c:332: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 descr[MAX_PATH]; data/python-psutil-5.7.3/psutil/arch/windows/socks.c:282:17: [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(&addr, tcp6Table->table[i].ucLocalAddr, 16); data/python-psutil-5.7.3/psutil/arch/windows/socks.c:305:17: [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(&addr, tcp6Table->table[i].ucRemoteAddr, 16); data/python-psutil-5.7.3/psutil/arch/windows/socks.c:425:17: [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(&addr, udp6Table->table[i].ucLocalAddr, 16); data/python-psutil-5.7.3/psutil/_psutil_aix.c:74:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nbytes = read(fd, fstruct, size); data/python-psutil-5.7.3/psutil/_psutil_aix.c:322:5: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(id.name, ""); data/python-psutil-5.7.3/psutil/_psutil_aix.c:774:5: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(id.name, ""); data/python-psutil-5.7.3/psutil/_psutil_aix.c:953:5: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(id.name, ""); data/python-psutil-5.7.3/psutil/_psutil_bsd.c:887:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifc_name, sdl->sdl_data, sdl->sdl_nlen); data/python-psutil-5.7.3/psutil/_psutil_common.h:20:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dst, src, n - 1); \ data/python-psutil-5.7.3/psutil/_psutil_osx.c:1365:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifc_name, sdl->sdl_data, sdl->sdl_nlen); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:75:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nbytes = read(fd, fstruct, size); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:145:23: [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). item_length = strlen(array[i]) + 1; data/python-psutil-5.7.3/psutil/_psutil_sunos.c:166:23: [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). item_length = strlen(array[i]); data/python-psutil-5.7.3/psutil/_psutil_sunos.c:208:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (info.pr_argc && strlen(info.pr_psargs) == PRARGSZ-1) { data/python-psutil-5.7.3/psutil/_psutil_sunos.c:923: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). if (strlen(p->pr_mapname) > 0) { data/python-psutil-5.7.3/psutil/_psutil_windows.c:913:52: [1] (buffer) wcslen: 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). py_domain = PyUnicode_FromWideChar(domainName, wcslen(domainName)); data/python-psutil-5.7.3/psutil/_psutil_windows.c:916:52: [1] (buffer) wcslen: 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). py_username = PyUnicode_FromWideChar(userName, wcslen(userName)); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1290:59: [1] (buffer) wcslen: 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). py_username = PyUnicode_FromWideChar(buffer_user, wcslen(buffer_user)); data/python-psutil-5.7.3/psutil/_psutil_windows.c:1419:45: [1] (buffer) wcslen: 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). wcslen(mappedFileName)); data/python-psutil-5.7.3/psutil/arch/aix/common.c:26:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). br = read(Kd, buf, len); data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:210:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). pos = pos + strlen(&argstr[pos]) + 1; data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:260:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (size == 0 || strlen(pathname) == 0) { data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:267:13: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(pathname, ""); data/python-psutil-5.7.3/psutil/arch/freebsd/specific.c:775: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). if (strlen(kve->kve_path) == 0) { data/python-psutil-5.7.3/psutil/arch/netbsd/specific.c:422:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). pos = pos + strlen(&argstr[pos]) + 1; data/python-psutil-5.7.3/psutil/arch/osx/process_info.c:181: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). len = strlen(arg_ptr); data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:106:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, buf, sizeof(buf)); data/python-psutil-5.7.3/psutil/arch/solaris/environ.c:260:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, buf, ptr_size); data/python-psutil-5.7.3/psutil/arch/windows/disk.c:315: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). if (strlen(opts) > 0) data/python-psutil-5.7.3/psutil/arch/windows/net.c:105:13: [1] (buffer) wcslen: 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). wcslen(pCurrAddresses->FriendlyName)); data/python-psutil-5.7.3/psutil/arch/windows/net.c:176:13: [1] (buffer) wcslen: 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). wcslen(pCurrAddresses->FriendlyName)); data/python-psutil-5.7.3/psutil/arch/windows/net.c:382:21: [1] (buffer) wcslen: 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). wcslen(pCurrAddresses->FriendlyName)); data/python-psutil-5.7.3/psutil/arch/windows/process_handles.c:252:46: [1] (buffer) wcslen: 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). wcslen(globalFileName->Buffer)); data/python-psutil-5.7.3/psutil/arch/windows/process_info.c:446:12: [1] (buffer) wcslen: 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 = wcslen(tmp->Buffer) + 1; data/python-psutil-5.7.3/psutil/arch/windows/process_info.c:513:13: [1] (buffer) wcslen: 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). wcslen(szArglist[i])); data/python-psutil-5.7.3/psutil/arch/windows/process_info.c:543:40: [1] (buffer) wcslen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ret = PyUnicode_FromWideChar(data, wcslen(data)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:144:41: [1] (buffer) wcslen: 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). lpService[i].lpServiceName, wcslen(lpService[i].lpServiceName)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:150:41: [1] (buffer) wcslen: 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). lpService[i].lpDisplayName, wcslen(lpService[i].lpDisplayName)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:226:29: [1] (buffer) wcslen: 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). qsc->lpDisplayName, wcslen(qsc->lpDisplayName)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:232:32: [1] (buffer) wcslen: 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). qsc->lpBinaryPathName, wcslen(qsc->lpBinaryPathName)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:238:34: [1] (buffer) wcslen: 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). qsc->lpServiceStartName, wcslen(qsc->lpServiceStartName)); data/python-psutil-5.7.3/psutil/arch/windows/services.c:395:34: [1] (buffer) wcslen: 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). scd->lpDescription, wcslen(scd->lpDescription)); ANALYSIS SUMMARY: Hits = 198 Lines analyzed = 19999 in approximately 0.45 seconds (44830 lines/second) Physical Source Lines of Code (SLOC) = 15006 Hits@level = [0] 11 [1] 39 [2] 111 [3] 4 [4] 43 [5] 1 Hits@level+ = [0+] 209 [1+] 198 [2+] 159 [3+] 48 [4+] 44 [5+] 1 Hits/KSLOC@level+ = [0+] 13.9278 [1+] 13.1947 [2+] 10.5958 [3+] 3.19872 [4+] 2.93216 [5+] 0.06664 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.