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/cpu-x-4.0.1/src/bandwidth/BMP.c Examining data/cpu-x-4.0.1/src/bandwidth/BMP.h Examining data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.c Examining data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.h Examining data/cpu-x-4.0.1/src/bandwidth/defs.h Examining data/cpu-x-4.0.1/src/bandwidth/font.c Examining data/cpu-x-4.0.1/src/bandwidth/font.h Examining data/cpu-x-4.0.1/src/bandwidth/libbandwidth.h Examining data/cpu-x-4.0.1/src/bandwidth/main.c Examining data/cpu-x-4.0.1/src/bandwidth/minifont.c Examining data/cpu-x-4.0.1/src/bandwidth/minifont.h Examining data/cpu-x-4.0.1/src/core.c Examining data/cpu-x-4.0.1/src/core.h Examining data/cpu-x-4.0.1/src/cpu-x.h Examining data/cpu-x-4.0.1/src/daemon.c Examining data/cpu-x-4.0.1/src/daemon.h Examining data/cpu-x-4.0.1/src/databases.h Examining data/cpu-x-4.0.1/src/dmidecode/config.h Examining data/cpu-x-4.0.1/src/dmidecode/dmidecode.c Examining data/cpu-x-4.0.1/src/dmidecode/dmidecode.h Examining data/cpu-x-4.0.1/src/dmidecode/dmioem.c Examining data/cpu-x-4.0.1/src/dmidecode/dmioem.h Examining data/cpu-x-4.0.1/src/dmidecode/dmiopt.c Examining data/cpu-x-4.0.1/src/dmidecode/dmiopt.h Examining data/cpu-x-4.0.1/src/dmidecode/dmioutput.c Examining data/cpu-x-4.0.1/src/dmidecode/dmioutput.h Examining data/cpu-x-4.0.1/src/dmidecode/types.h Examining data/cpu-x-4.0.1/src/dmidecode/util.c Examining data/cpu-x-4.0.1/src/dmidecode/util.h Examining data/cpu-x-4.0.1/src/gui_gtk.c Examining data/cpu-x-4.0.1/src/gui_gtk.h Examining data/cpu-x-4.0.1/src/gui_gtk_id.h Examining data/cpu-x-4.0.1/src/ipc.h Examining data/cpu-x-4.0.1/src/main.c Examining data/cpu-x-4.0.1/src/tui_ncurses.c Examining data/cpu-x-4.0.1/src/tui_ncurses.h Examining data/cpu-x-4.0.1/src/util.c FINAL RESULTS: data/cpu-x-4.0.1/src/core.c:733:10: [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((n = readlink(format("%s/driver", device_path), buff, MAXSTR)) < 0) data/cpu-x-4.0.1/src/daemon.c:160:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod(DEV_PCI, DEFFILEMODE); // 0666 data/cpu-x-4.0.1/src/daemon.c:178:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod(SYS_DEBUG, S_IRWXU|S_IXGRP|S_IXOTH); // 0711 data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5191:6: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(cpux_data->memory[cpux_data->dimm_count], specs, MAXSTR); data/cpu-x-4.0.1/src/main.c:436:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(shortopts, shortopt, SHORT_OPTS_SIZE - 1); data/cpu-x-4.0.1/src/bandwidth/main.c:314:14: [4] (shell) popen: 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. FILE *f = popen ("sysctl machdep.xcpm.cpu_thermal_level | sed '\''s/machdep.xcpm.cpu_thermal_level/CPU temperature/'\''", "r"); data/cpu-x-4.0.1/src/bandwidth/main.c:1903:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (chunk + chunk_len, "%s %s\n", s, "transp"); data/cpu-x-4.0.1/src/bandwidth/main.c:1928:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (title, "%s send (solid)", hostname); data/cpu-x-4.0.1/src/bandwidth/main.c:2043:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (title, "%s receive (dashed)", hostname); data/cpu-x-4.0.1/src/bandwidth/main.c:2193:4: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (graph_title, TITLE_MEMORY_NET); data/cpu-x-4.0.1/src/bandwidth/main.c:2340:13: [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 (-1 == system ("grep MHz /proc/cpuinfo | uniq | sed \"s/[\\t\\n: a-zA-Z]//g\" > "TMPFILE)) data/cpu-x-4.0.1/src/bandwidth/main.c:3074:13: [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 (-1 == system ("grep MHz /proc/cpuinfo | uniq | sed \"s/[\\t\\n: a-zA-Z]//g\" > "TMPFILE)) data/cpu-x-4.0.1/src/core.c:360:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(tmp, MAXSTR, fmt_cache_mb, datanr.l4_cache >> 10, UNIT_MB, datanr.l4_assoc); data/cpu-x-4.0.1/src/core.c:677:10: [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. return !access(format("%s/driver", device_path), F_OK); data/cpu-x-4.0.1/src/core.c:696:32: [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((base = pci_get_param(dev->access, "sysfs.path")) == NULL) data/cpu-x-4.0.1/src/core.c:784:18: [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(DAEMON_UP && access(DEV_PCI, W_OK)) data/cpu-x-4.0.1/src/core.c:789:12: [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(ret && access(DEV_PCI, W_OK)) data/cpu-x-4.0.1/src/core.c:853:7: [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(SYS_DEBUG_DRI, X_OK)) data/cpu-x-4.0.1/src/core.c:940:9: [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(amdgpu_gpu_busy_file, F_OK)) // Linux 4.19+ data/cpu-x-4.0.1/src/cpu-x.h:51:33: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define GOTO_ERROR(str) { snprintf(error_str, MAXSTR, str); goto error; } data/cpu-x-4.0.1/src/cpu-x.h:60:31: [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. #define MSG_STDOUT(fmt, ...) fprintf(stdout, colorized_msg(DEFAULT, "%s", fmt), ##__VA_ARGS__) data/cpu-x-4.0.1/src/cpu-x.h:61:31: [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. #define MSG_STDERR(fmt, ...) fprintf(stderr, colorized_msg(DEFAULT, "%s", fmt), ##__VA_ARGS__) data/cpu-x-4.0.1/src/cpu-x.h:62:47: [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. #define MSG_VERBOSE(fmt, ...) opts->verbose ? fprintf(stdout, colorized_msg(BOLD_GREEN, "%s", fmt), ##__VA_ARGS__) : 0 data/cpu-x-4.0.1/src/cpu-x.h:63:31: [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. #define MSG_WARNING(fmt, ...) fprintf(stdout, colorized_msg(BOLD_YELLOW, "%s", fmt), ##__VA_ARGS__) data/cpu-x-4.0.1/src/cpu-x.h:64:31: [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. #define MSG_ERROR(fmt, ...) fprintf(stderr, colorized_msg(BOLD_RED, "%s:%s:%i: %s", LOCATION, fmt), ##__VA_ARGS__) data/cpu-x-4.0.1/src/cpu-x.h:65:31: [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. #define MSG_ERRNO(fmt, ...) fprintf(stderr, colorized_msg(BOLD_RED, "%s:%s:%i: %s (%s)", LOCATION, fmt, strerror(errno)), ##__VA_ARGS__) data/cpu-x-4.0.1/src/daemon.c:69:2: [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. vsnprintf(buff, MSG_BUFF_LEN, fmt, aptr); data/cpu-x-4.0.1/src/daemon.c:173:5: [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(SYS_DEBUG_DRI, R_OK)) data/cpu-x-4.0.1/src/daemon.c:210: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. ret = system(load_cmd); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:241:11: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(raw_data + off, i ? " %02X" : "%02X", data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:261:14: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(raw_data + off, data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1281:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(voltage_str + off, data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1574:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(type_str + off, data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1736:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(type_str + off, data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2753:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(list + off, off ? " %s" : "%s", data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2805:12: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. off += sprintf(list + off, off ? " %s" : "%s", data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3809:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(attr, "%s Address", addrstr); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3814:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(attr, "%s Mask", addrstr); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3837:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(attr, "%s Redfish Service Address", addrstr); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3843:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(attr, "%s Redfish Service Mask", addrstr); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:32:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:42:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:58:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:70:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:82:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:98:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:112:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/dmidecode/dmioutput.c:134:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args); data/cpu-x-4.0.1/src/gui_gtk.c:92:3: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp((*argv)[0], *argv); data/cpu-x-4.0.1/src/gui_gtk.c:502:22: [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. const int pkcheck = system(format("pkcheck --action-id org.freedesktop.policykit.exec --process %u > /dev/null 2>&1", getpid())); data/cpu-x-4.0.1/src/util.c:128:2: [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. vsnprintf(buff, MSG_BUFF_LEN, fmt, aptr); data/cpu-x-4.0.1/src/util.c:146:5: [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(file_str, R_OK)) data/cpu-x-4.0.1/src/util.c:182:19: [4] (shell) popen: 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((pipe_descr = popen(cmd_str, "r")) == NULL) data/cpu-x-4.0.1/src/util.c:207:10: [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 !system(buff); data/cpu-x-4.0.1/src/util.c:226: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. ret = system(check_cmd); data/cpu-x-4.0.1/src/util.c:277:9: [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. err = access(*cached_path, R_OK); data/cpu-x-4.0.1/src/util.c:294:9: [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. err = access(*cached_path, R_OK); data/cpu-x-4.0.1/src/util.c:418:3: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(cmd[0], cmd); data/cpu-x-4.0.1/src/bandwidth/libbandwidth.h:74:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bool random; data/cpu-x-4.0.1/src/bandwidth/main.c:534:46: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. do_write (unsigned long size, int mode, bool random) data/cpu-x-4.0.1/src/bandwidth/main.c:573:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) { data/cpu-x-4.0.1/src/bandwidth/main.c:604:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:651:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:655:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) data/cpu-x-4.0.1/src/bandwidth/main.c:662:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:673:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:684:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:694:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:701:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:741:45: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. do_read (unsigned long size, int mode, bool random) data/cpu-x-4.0.1/src/bandwidth/main.c:771:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) { data/cpu-x-4.0.1/src/bandwidth/main.c:802:6: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:869:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:873:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) data/cpu-x-4.0.1/src/bandwidth/main.c:880:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:893:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) data/cpu-x-4.0.1/src/bandwidth/main.c:904:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:914:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:920:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:926:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:932:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!random) { data/cpu-x-4.0.1/src/bandwidth/main.c:939:8: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random) { data/cpu-x-4.0.1/src/bandwidth/main.c:2388:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2425:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2468:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2482:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2550:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2619:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:2701:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:3117:27: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if(tests[opts->bw_test].random) data/cpu-x-4.0.1/src/bandwidth/main.c:3118:4: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time (NULL)); data/cpu-x-4.0.1/src/bandwidth/main.c:3136:111: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int amount = (*tests[opts->bw_test].func_ptr)(chunk_size, tests[opts->bw_test].mode, tests[opts->bw_test].random); data/cpu-x-4.0.1/src/daemon.c:331:5: [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("CPUX_DAEMON_DEBUG")) data/cpu-x-4.0.1/src/dmidecode/dmiopt.c:284:19: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((option = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) data/cpu-x-4.0.1/src/main.c:441:17: [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(HAS_GTK && (getenv("DISPLAY") != NULL || getenv("WAYLAND_DISPLAY") != NULL)) data/cpu-x-4.0.1/src/main.c:441:46: [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(HAS_GTK && (getenv("DISPLAY") != NULL || getenv("WAYLAND_DISPLAY") != NULL)) data/cpu-x-4.0.1/src/main.c:449:13: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while((c = getopt_long(argc, argv, shortopts, longopts, &longindex)) != -1) data/cpu-x-4.0.1/src/main.c:539:5: [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("CPUX_NETWORK")) data/cpu-x-4.0.1/src/main.c:540:30: [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. opts->use_network = ((atoi(getenv("CPUX_NETWORK"))) > 0); data/cpu-x-4.0.1/src/main.c:541:5: [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("CPUX_BCLK")) data/cpu-x-4.0.1/src/main.c:542:25: [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. data->bus_freq = atof(getenv("CPUX_BCLK")); data/cpu-x-4.0.1/src/main.c:543:5: [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("CPUX_CPUID_RAW")) data/cpu-x-4.0.1/src/main.c:544:34: [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. data->l_data->cpuid_raw_file = getenv("CPUX_CPUID_RAW"); data/cpu-x-4.0.1/src/main.c:545:5: [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("CPUX_DEBUG_DATABASE")) data/cpu-x-4.0.1/src/main.c:546:33: [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. opts->debug_database = ((atoi(getenv("CPUX_DEBUG_DATABASE"))) > 0); data/cpu-x-4.0.1/src/main.c:547:5: [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("CPUX_FORCE_FREQ_FALLBACK")) data/cpu-x-4.0.1/src/main.c:548:32: [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. opts->freq_fallback = ((atoi(getenv("CPUX_FORCE_FREQ_FALLBACK"))) > 0); data/cpu-x-4.0.1/src/main.c:595:24: [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. char *TEXTDOMAINDIR = getenv("TEXTDOMAINDIR"); data/cpu-x-4.0.1/src/tui_ncurses.c:73:6: [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("TERMINFO")) data/cpu-x-4.0.1/src/tui_ncurses.c:85:80: [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. MSG_WARNING(_("Failed to set up %s terminal (err=%i); falling back to %s"), getenv("TERM"), err, DEFAULT_TERM); data/cpu-x-4.0.1/src/util.c:402:23: [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. char *const appdir = getenv("APPDIR"); data/cpu-x-4.0.1/src/bandwidth/BMP.c:727:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char h[HDRLEN]; data/cpu-x-4.0.1/src/bandwidth/BMP.c:740: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, "wb"); data/cpu-x-4.0.1/src/bandwidth/BMP.c:784: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. unsigned char rgb[3]; data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.c:62:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str [200]; data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.c:122: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 str [200]; data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.c:391: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 str[200]; data/cpu-x-4.0.1/src/bandwidth/BMPGraphing.c:409: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 str[200]; data/cpu-x-4.0.1/src/bandwidth/main.c:251:2: [2] (buffer) wchar_t: 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. wchar_t tmp [200]; data/cpu-x-4.0.1/src/bandwidth/main.c:284:21: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). csv_output_file = fopen (csv_file_path, "wb"); data/cpu-x-4.0.1/src/bandwidth/main.c:316: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 buffer [POPEN_BUFSIZE] = {0}; data/cpu-x-4.0.1/src/bandwidth/main.c:324:25: [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). cpu_temperature = atoi (buffer + i); data/cpu-x-4.0.1/src/bandwidth/main.c:1114: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 ("/dev/fb0", O_RDWR); data/cpu-x-4.0.1/src/bandwidth/main.c:1116: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 ("/dev/fb/0", O_RDWR); data/cpu-x-4.0.1/src/bandwidth/main.c:1600: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 (a2, a1, NT_SIZE); data/cpu-x-4.0.1/src/bandwidth/main.c:1663: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 (chunk, "%lu\n", n_chunks); data/cpu-x-4.0.1/src/bandwidth/main.c:1738: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 (str, "%u.%u.%u.%u", a,b,c,d); data/cpu-x-4.0.1/src/bandwidth/main.c:1802: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 ipstring[30]; data/cpu-x-4.0.1/src/bandwidth/main.c:1811: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 chunk [NETWORK_CHUNK_SIZE+1]; data/cpu-x-4.0.1/src/bandwidth/main.c:1856:3: [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 (chunk, "OK: %lu\n", duration); data/cpu-x-4.0.1/src/bandwidth/main.c:1890: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 chunk [NETWORK_CHUNK_SIZE]; data/cpu-x-4.0.1/src/bandwidth/main.c:1892: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 (chunk, "000000000000\n%d\n", n_destinations); data/cpu-x-4.0.1/src/bandwidth/main.c:1927: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 title [PATH_MAX]; data/cpu-x-4.0.1/src/bandwidth/main.c:2093: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 graph_title [512] = {0}; data/cpu-x-4.0.1/src/bandwidth/main.c:2113:20: [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). network_port = atoi (argv[i++]); data/cpu-x-4.0.1/src/bandwidth/main.c:2241: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. static char family [17]; data/cpu-x-4.0.1/src/bandwidth/main.c:2343:13: [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 (TMPFILE, "r"); data/cpu-x-4.0.1/src/bandwidth/main.c:2892: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 graph_title [512] = {0}; data/cpu-x-4.0.1/src/bandwidth/main.c:2986: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. static char family [17]; data/cpu-x-4.0.1/src/bandwidth/main.c:3077:13: [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 (TMPFILE, "r"); data/cpu-x-4.0.1/src/core.c:146: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 error_str[MAXSTR]; data/cpu-x-4.0.1/src/core.c:239: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[MAXSTR * 2] = ""; data/cpu-x-4.0.1/src/core.c:614:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen("/proc/stat","r"); data/cpu-x-4.0.1/src/core.c:629: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(pre, new, LASTSTAT * sizeof(long)); data/cpu-x-4.0.1/src/core.c:710: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 buff[MAXSTR] = ""; data/cpu-x-4.0.1/src/core.c:775: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 gpu_driver[MAXSTR] = "", buff[MAXSTR] = ""; data/cpu-x-4.0.1/src/core.c:878: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. static char *cached_paths_drm[LASTGRAPHICS / GPUFIELDS] = { NULL }; data/cpu-x-4.0.1/src/core.c:879: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. static char *cached_paths_hwmon[LASTGRAPHICS / GPUFIELDS] = { NULL }; data/cpu-x-4.0.1/src/core.c:895:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char gpu_driver[MAXSTR] = ""; data/cpu-x-4.0.1/src/core.c:1055: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[MAXSTR]; data/cpu-x-4.0.1/src/cpu-x.h:234: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 *device_path[LASTGRAPHICS / GPUFIELDS]; data/cpu-x-4.0.1/src/cpu-x.h:249: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 *objects[LASTOBJ]; data/cpu-x-4.0.1/src/cpu-x.h:250: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 *tab_cpu[2][LASTCPU]; data/cpu-x-4.0.1/src/cpu-x.h:251: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 *tab_caches[2][LASTCACHES]; data/cpu-x-4.0.1/src/cpu-x.h:252: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 *tab_motherboard[2][LASTMOTHERBOARD]; data/cpu-x-4.0.1/src/cpu-x.h:253: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 *tab_memory[2][LASTMEMORY]; data/cpu-x-4.0.1/src/cpu-x.h:254: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 *tab_system[2][LASTSYSTEM]; data/cpu-x-4.0.1/src/cpu-x.h:255: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 *tab_graphics[2][LASTGRAPHICS]; data/cpu-x-4.0.1/src/cpu-x.h:256: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 *tab_bench[2][LASTBENCH]; data/cpu-x-4.0.1/src/cpu-x.h:257: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 *tab_about[LASTABOUT]; data/cpu-x-4.0.1/src/daemon.c:63: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 fmt[MSG_BUFF_LEN]; data/cpu-x-4.0.1/src/daemon.c:64: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. static char buff[MSG_BUFF_LEN]; data/cpu-x-4.0.1/src/daemon.c:314: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 error_str[MAXSTR] = "unknown"; data/cpu-x-4.0.1/src/dmidecode/dmidecode.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. static char raw_data[48]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:280:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const char *unit[8] = { data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:342: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. static char size[STR_LEN] = ""; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:354:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const char *unit[4] = { data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:369: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. static char size[STR_LEN] = ""; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:370:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const char *unit[4] = { data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1076:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const char *flags[32] = { data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1273: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 voltage_str[18]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1566: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 type_str[68]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1675:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const char *location[4] = { data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:1728: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 type_str[70]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2184: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 attr[16]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2189:3: [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(attr, "Peer Device %hu", i); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2248: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 attr[11]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2255:3: [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(attr, "String %hu", i); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2266: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 attr[11]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2273:3: [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(attr, "Option %hu", i); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2450: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 attr[16]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2457:4: [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(attr, "Descriptor %hu", i + 1); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2460:4: [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(attr, "Data Format %hu", i + 1); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2579: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. static char size[STR_LEN] = ""; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2614: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. static char size[STR_LEN] = ""; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2742: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 list[172]; /* Update length if you touch the array above */ data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2795: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 list[99]; /* Update length if you touch the array above */ data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3135: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 time[15]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3140:10: [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. off += sprintf(time + off, "%02X", p[0]); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3144:10: [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. off += sprintf(time + off, "-%02X", p[1]); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3146:10: [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. off += sprintf(time + off, "-*"); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3148:10: [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. off += sprintf(time + off, " %02X", p[2]); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3150:10: [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. off += sprintf(time + off, " *"); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3152:10: [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. off += sprintf(time + off, ":%02X", p[3]); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3154:10: [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. off += sprintf(time + off, ":*"); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3156:10: [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. off += sprintf(time + off, ":%02X", p[4]); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3158:10: [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. off += sprintf(time + off, ":*"); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3460: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 attr[18]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3465:3: [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(attr, "Device %hu Load", i); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3469:4: [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(attr, "Device %hu Handle", i); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3742: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[64]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3748: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 attr[38]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:4042: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 vendor_id[5]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5184:6: [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 specs[MAXSTR]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5520: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(crafted, buf, 32); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5581: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(crafted, buf, 32); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5610: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(crafted, buf, 16); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5632: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 linebuf[64]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5634: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 addrstr[KENV_MVALLEN + 1]; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5646:20: [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 ((efi_systab = fopen(filename = "/sys/firmware/efi/systab", "r")) == NULL data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5647:20: [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). && (efi_systab = fopen(filename = "/proc/efi/systab", "r")) == NULL) data/cpu-x-4.0.1/src/dmidecode/dmioem.c:131: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 attr[8]; data/cpu-x-4.0.1/src/dmidecode/dmioem.c:136: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(attr, "NIC %hu", id); data/cpu-x-4.0.1/src/dmidecode/util.c:108: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). if ((fd = open(filename, O_RDONLY)) == -1) data/cpu-x-4.0.1/src/dmidecode/util.c:166: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, src, n); data/cpu-x-4.0.1/src/dmidecode/util.c:184: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). if ((fd = open(devmem, O_RDONLY)) == -1) data/cpu-x-4.0.1/src/dmidecode/util.c:266: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(dumpfile, add ? "r+b" : "wb"); data/cpu-x-4.0.1/src/gui_gtk.c:666:16: [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). page = atoi(widget_name); data/cpu-x-4.0.1/src/gui_gtk_id.h:31:14: [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 *trad[LASTOBJ] = data/cpu-x-4.0.1/src/gui_gtk_id.h:45:14: [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 *objectcpu[LASTCPU] = data/cpu-x-4.0.1/src/gui_gtk_id.h:54:14: [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 *objectcache[LASTCACHES] = data/cpu-x-4.0.1/src/gui_gtk_id.h:63:14: [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 *objectmb[LASTMOTHERBOARD] = data/cpu-x-4.0.1/src/gui_gtk_id.h:71:14: [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 *objectram[LASTMEMORY] = data/cpu-x-4.0.1/src/gui_gtk_id.h:78:14: [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 *objectsys[LASTSYSTEM] = data/cpu-x-4.0.1/src/gui_gtk_id.h:84:14: [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 *objectsys_bar[LASTBAR] = data/cpu-x-4.0.1/src/gui_gtk_id.h:90:14: [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 *objectgpu[LASTGRAPHICS] = data/cpu-x-4.0.1/src/gui_gtk_id.h:99:14: [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 *objectbench[LASTBENCH] = data/cpu-x-4.0.1/src/gui_gtk_id.h:107:14: [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 *objectabout[LASTABOUT] = data/cpu-x-4.0.1/src/gui_gtk_id.h:114:14: [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 *nicktab[NO_ABOUT + 1] = data/cpu-x-4.0.1/src/ipc.h:60: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 cpu_package[MAXSTR]; data/cpu-x-4.0.1/src/ipc.h:61: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 motherboard[CHIPVENDOR][MAXSTR]; data/cpu-x-4.0.1/src/ipc.h:62: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 memory[LASTMEMORY][MAXSTR]; data/cpu-x-4.0.1/src/main.c:356: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 buff[MAXSTR]; data/cpu-x-4.0.1/src/main.c:426: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 shortopt[SHORT_OPT_SIZE], shortopts[SHORT_OPTS_SIZE] = ""; data/cpu-x-4.0.1/src/main.c:469: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). tmp_arg = atoi(optarg); data/cpu-x-4.0.1/src/main.c:474: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). tmp_arg = atoi(optarg); data/cpu-x-4.0.1/src/main.c:479: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). tmp_arg = atoi(optarg); data/cpu-x-4.0.1/src/main.c:484: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). tmp_arg = atoi(optarg); data/cpu-x-4.0.1/src/main.c:486:22: [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). opts->bw_test = atoi(optarg); data/cpu-x-4.0.1/src/main.c:540:25: [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). opts->use_network = ((atoi(getenv("CPUX_NETWORK"))) > 0); data/cpu-x-4.0.1/src/main.c:546:28: [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). opts->debug_database = ((atoi(getenv("CPUX_DEBUG_DATABASE"))) > 0); data/cpu-x-4.0.1/src/main.c:548:27: [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). opts->freq_fallback = ((atoi(getenv("CPUX_FORCE_FREQ_FALLBACK"))) > 0); data/cpu-x-4.0.1/src/tui_ncurses.c:488: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 buff[BUFF_SIZE]; data/cpu-x-4.0.1/src/util.c:75:59: [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). remove = (((*str)[0] == '0') && (atof(*str) == 0.0)) || (atoi(*str) < 0); data/cpu-x-4.0.1/src/util.c:80:59: [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). if(((((*str)[i] == '0') && (atof(*str + i) == 0.0)) || (atoi(*str + i) < 0)) && (isspace((*str)[i - 1]))) data/cpu-x-4.0.1/src/util.c:101: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. static char *buff[BUFFER_COUNT] = { NULL }; data/cpu-x-4.0.1/src/util.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 fmt[MSG_BUFF_LEN]; data/cpu-x-4.0.1/src/util.c:120: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. static char buff[MSG_BUFF_LEN]; data/cpu-x-4.0.1/src/util.c:137: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[MAXSTR], error_str[MAXSTR] = "unknown"; data/cpu-x-4.0.1/src/util.c:152:19: [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((file_descr = fopen(file_str, "r")) == NULL) data/cpu-x-4.0.1/src/util.c:173: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[MAXSTR], error_str[MAXSTR] = "unknown"; data/cpu-x-4.0.1/src/util.c:203: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 buff[MAXSTR]; data/cpu-x-4.0.1/src/bandwidth/BMP.c:437: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). int width2 = s2 ? strlen (s2) : 0; data/cpu-x-4.0.1/src/bandwidth/BMP.c:497:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int w = ptr ? strlen (ptr) : 0; data/cpu-x-4.0.1/src/bandwidth/BMP.c:573: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). int width2 = s2 ? strlen (s2) : 0; data/cpu-x-4.0.1/src/bandwidth/BMP.c:633:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int w = ptr ? strlen (ptr) : 0; data/cpu-x-4.0.1/src/bandwidth/BMP.c:678:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int width = strlen (narrow_nums [ix]); data/cpu-x-4.0.1/src/bandwidth/main.c:1813:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int amount_read = read (sock, chunk, NETWORK_CHUNK_SIZE); data/cpu-x-4.0.1/src/bandwidth/main.c:1840:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). amount_read = read (sock, chunk, NETWORK_CHUNK_SIZE); data/cpu-x-4.0.1/src/bandwidth/main.c:1895:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int chunk_len = strlen (chunk); data/cpu-x-4.0.1/src/bandwidth/main.c:1896: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). int len = strlen (s); data/cpu-x-4.0.1/src/core.c:156:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) - 1); data/cpu-x-4.0.1/src/core.c:372:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(tmp, "HT", MAXSTR * 2 - strlen(tmp)); data/cpu-x-4.0.1/src/core.c:372:35: [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). strncat(tmp, "HT", MAXSTR * 2 - strlen(tmp)); data/cpu-x-4.0.1/src/core.c:416: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). j = strlen(tmp); data/cpu-x-4.0.1/src/core.c:418:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(tmp, ", ", MAXSTR * 2 - j); data/cpu-x-4.0.1/src/core.c:419:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(tmp, cpu_flags[i].str, MAXSTR * 2 - j); data/cpu-x-4.0.1/src/core.c:518: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). const ssize_t len = strlen(str) + 1; data/cpu-x-4.0.1/src/core.c:740:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(driver_name, (drv == NULL) ? buff : drv + 1, MAXSTR); data/cpu-x-4.0.1/src/core.c:966: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((gclk != NULL) && (strlen(gclk) >= 2)) gclk[strlen(gclk) - 2] = '\0'; data/cpu-x-4.0.1/src/core.c:966:52: [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((gclk != NULL) && (strlen(gclk) >= 2)) gclk[strlen(gclk) - 2] = '\0'; data/cpu-x-4.0.1/src/core.c:967: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((mclk != NULL) && (strlen(mclk) >= 2)) mclk[strlen(mclk) - 2] = '\0'; data/cpu-x-4.0.1/src/core.c:967:52: [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((mclk != NULL) && (strlen(mclk) >= 2)) mclk[strlen(mclk) - 2] = '\0'; data/cpu-x-4.0.1/src/daemon.c:95:2: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, &selected_core, sizeof(uint8_t)); // Core 0 on failure data/cpu-x-4.0.1/src/daemon.c:238:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(td->fd, &cmd, sizeof(DaemonCommand)) != sizeof(DaemonCommand)) data/cpu-x-4.0.1/src/daemon.c:319:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/cpu-x-4.0.1/src/daemon.c:359:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) - 1); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:136:9: [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). bp += strlen(bp); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:145: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). ascii_filter(bp, strlen(bp)); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:255:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int j, l = strlen(s) + 1; data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2582:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(size, "Empty", STR_LEN); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:2584:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(size, "Unknown", STR_LEN); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3142:10: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. off += sprintf(time + off, "*"); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:3867:10: [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). hlen = strlen(out_of_spec); data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5181: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). if((strlen(manufacturer) > 0) || (strlen(part_number) > 0)) data/cpu-x-4.0.1/src/dmidecode/dmidecode.c:5181:41: [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(manufacturer) > 0) || (strlen(part_number) > 0)) data/cpu-x-4.0.1/src/dmidecode/dmioem.c:59: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/cpu-x-4.0.1/src/dmidecode/util.c:57:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, buf + r2, count - r2); data/cpu-x-4.0.1/src/ipc.h:33:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define RECEIVE_DATA(pfd, pdata, size) if(read (*pfd, pdata, size) != size) { MSG_ERRNO("%s", "read"); close(*pfd); *pfd = -1; return 1; } data/cpu-x-4.0.1/src/tui_ncurses.c:317: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). const size_t ptr_len = strlen(ptr) + 1; data/cpu-x-4.0.1/src/tui_ncurses.c:322:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. f1 = strncat(strtok(ptr, ": "), ":", ptr_len); data/cpu-x-4.0.1/src/tui_ncurses.c:463:47: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). mvwprintwc(win, TITLE_LINE, info.width / 2 - strlen(PRGNAME) / 2, TITLE_COLOR, PRGNAME); data/cpu-x-4.0.1/src/tui_ncurses.c:478:10: [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). cpt += strlen(data->objects[i]) + 2; data/cpu-x-4.0.1/src/util.c:158: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). tmp[strlen(tmp) - 1] = '\0'; data/cpu-x-4.0.1/src/util.c:188: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). tmp[strlen(tmp) - 1] = '\0'; data/cpu-x-4.0.1/src/util.c:215: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). const ssize_t len = strlen(module) + 1; ANALYSIS SUMMARY: Hits = 296 Lines analyzed = 20816 in approximately 0.66 seconds (31448 lines/second) Physical Source Lines of Code (SLOC) = 15824 Hits@level = [0] 218 [1] 44 [2] 141 [3] 53 [4] 53 [5] 5 Hits@level+ = [0+] 514 [1+] 296 [2+] 252 [3+] 111 [4+] 58 [5+] 5 Hits/KSLOC@level+ = [0+] 32.4823 [1+] 18.7058 [2+] 15.9252 [3+] 7.01466 [4+] 3.66532 [5+] 0.315976 Dot directories skipped = 2 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.