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/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp Examining data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c Examining data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/perfmon-i7z.cpp Examining data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/perfmon-i7z.h Examining data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp Examining data/i7z-0.27.2+git2013.10.12-g5023138/test-scripts/test_cpuid_issue.cpp Examining data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c Examining data/i7z-0.27.2+git2013.10.12-g5023138/i7z.h Examining data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c Examining data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c Examining data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c FINAL RESULTS: data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:180:16: [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. tmp_file = popen ("sed -n '/MHz/ { s/cpu\\sMHz\\s*:\\s//p; q }' /proc/cpuinfo", "r"); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:142:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(socket_list,"%s%d,",socket_list,socket->processor_num[i]); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:162:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(strinfo); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:501: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 ("/dev/cpu/0/msr", F_OK) == 0) data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:504:13: [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 ("/dev/cpu/0/msr", W_OK) == 0) data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:521: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. system ("msr_major=202; \ data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:532: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. system ("modprobe msr"); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:548:16: [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. tmp_file = popen ("sed -n '/MHz/ { s/cpu\\sMHz\\s*:\\s//p; q }' /proc/cpuinfo", "r"); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:674:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(socket_list,"%s%d,",socket_list,socket->processor_num[i]); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:755: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(filename, F_OK) == 0) data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:75:5: [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(str_file1,100,CPU_FREQUENCY_LOGGING_FILE_dual,socket_num); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:78:5: [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(str_file2,100,CSTATE_LOGGING_FILE_dual,socket_num); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:384:5: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system("stty sane"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:389:5: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system("modprobe msr"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:471: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(log_file_name2, log_file_name); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:55:9: [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(str_file,100,CPU_FREQUENCY_LOGGING_FILE_dual,0); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:59:9: [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(str_file,100,CPU_FREQUENCY_LOGGING_FILE_dual,1); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:458: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 ("/dev/cpu/0/msr", F_OK) == 0) data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:461:13: [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 ("/dev/cpu/0/msr", W_OK) == 0) data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:477: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. system ("msr_major=202; \ data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:488: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. system ("modprobe msr"); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:501:5: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:631:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(socket_list,"%s%d,",socket_list,socket->processor_num[i]); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:441: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. c = getopt_long(argc, argv,"w:z:y:l:hn", long_options, &option_index); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/perfmon-i7z.cpp:533:14: [3] (buffer) getopt: 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(argc, argv, "l:")) != -1) { data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:181: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 tmp_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:211: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 HT_ON_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:214:9: [2] (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 string. strcpy (HT_ON_str, "Hyper Threading ON"); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:219:9: [2] (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 string. strcpy (HT_ON_str, "Hyper Threading OFF"); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:421: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 (old_val_CORE, new_val_CORE, sizeof (unsigned long int) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:422: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 (old_val_REF, new_val_REF, sizeof (unsigned long int) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:423: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 (old_val_C3, new_val_C3, sizeof (unsigned long int) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:424: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 (old_val_C6, new_val_C6, sizeof (unsigned long int) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:425: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 (tvstart, tvstop, sizeof (struct timeval) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:426: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 (old_TSC, new_TSC, sizeof (unsigned long long int) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:428: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 (FREQ, _FREQ, sizeof (double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:429: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 (MULT, _MULT, sizeof (double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:430: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 (C0_TIME, C0_time, sizeof (long double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:431: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 (C1_TIME, C1_time, sizeof (long double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:432: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 (C3_TIME, C3_time, sizeof (long double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:433: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 (C6_TIME, C6_time, sizeof (long double) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:469: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 processor_str[100]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:585: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 processor_str[100]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:623: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 val2set[100]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:672: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 hostname[1024]; data/i7z-0.27.2+git2013.10.12-g5023138/GUI/i7z_GUI.cpp:678: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 str_display[1050]; data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:37: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:49: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:61: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:104: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 socket_1_list[200]="", socket_0_list[200]=""; data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:137: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 socket_list[200]=""; data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:151:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen("/proc/cpuinfo","r"); data/i7z-0.27.2+git2013.10.12-g5023138/cpuinfo.c:152: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 strinfo[200]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:116: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 (vendor_string, &b, 4); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:117: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 (&vendor_string[4], &d, 4); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:118: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 (&vendor_string[8], &c, 4); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:235: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 msr_file_name[64]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:239: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 (msr_file_name, "/dev/cpu/%d/msr", cpu); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:240: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 (msr_file_name, O_RDONLY); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:290: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 msr_file_name[64]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:292: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 (msr_file_name, "/dev/cpu/%d/msr", cpu); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:293: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 (msr_file_name, O_WRONLY); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:348: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 vendor_string[13]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:549: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 tmp_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:561: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:573: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:585: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:669: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 socket_list[200]=""; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:682:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen("/proc/cpuinfo","r"); data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:683: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 strinfo[200]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:48:28: [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_log_file_freq = fopen(CPU_FREQUENCY_LOGGING_FILE_single,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:49:31: [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_log_file_Cstates = fopen(CSTATE_LOGGING_FILE_single,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:51:28: [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_log_file_freq = fopen(CPU_FREQUENCY_LOGGING_FILE_single,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:52:31: [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_log_file_Cstates = fopen(CSTATE_LOGGING_FILE_single,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.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 str_file1[100]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:77: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_file2[100]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:82:34: [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_log_file_freq_1 = fopen(str_file1,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:84:34: [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_log_file_freq_1 = fopen(str_file1,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:88:34: [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_log_file_freq_2 = fopen(str_file1,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:90:34: [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_log_file_freq_2 = fopen(str_file1,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:95:37: [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_log_file_Cstates_1 = fopen(str_file2,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:97:37: [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_log_file_Cstates_1 = fopen(str_file2,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:101:37: [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_log_file_Cstates_2 = fopen(str_file2,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:103:37: [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_log_file_Cstates_2 = fopen(str_file2,"a"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:414: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 log_file_name[MAX_FILENAME_LENGTH], log_file_name2[MAX_FILENAME_LENGTH+3]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:447:32: [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). socket_0_num = atoi(optarg); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:452:32: [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). socket_1_num = atoi(optarg); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:472:17: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(log_file_name2, "_%d"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:54: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 str_file[100]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:56:23: [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_log_file = fopen(str_file,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:60:23: [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_log_file = fopen(str_file,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:104: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 print_core[32]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:181: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 string_ptr1[200], string_ptr2[200]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:224: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 0 cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:225: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 (string_ptr2, " "); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:229: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2 cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:230: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 (string_ptr2, " %dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:234: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2/3/4 cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:235: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 (string_ptr2, " %dx/%dx/%dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C, MAX_TURBO_3C, MAX_TURBO_4C); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:239: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:240: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 (string_ptr2, " %dx/%dx/%dx/%dx/%dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C, MAX_TURBO_3C, MAX_TURBO_4C, data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:626: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 (old_val_CORE, new_val_CORE, data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:628: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 (old_val_REF, new_val_REF, sizeof (*old_val_REF) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:629: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 (old_val_C3, new_val_C3, sizeof (*old_val_C3) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:630: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 (old_val_C6, new_val_C6, sizeof (*old_val_C6) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:632: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 (old_val_C7, new_val_C7, sizeof (*old_val_C7) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:634: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 (tvstart, tvstop, sizeof (*tvstart) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:635: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 (old_TSC, new_TSC, sizeof (*old_TSC) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:709: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 HT_ON_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:62:28: [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_log_file_freq = fopen(CPU_FREQUENCY_LOGGING_FILE_single,"w"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:130: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 print_core[32]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:204: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 string_ptr1[200], string_ptr2[200]; data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:248: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 0 cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:249: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 (string_ptr2, " %dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:252: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2 Cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:253: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 (string_ptr2, " "); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:256: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:257: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 (string_ptr2, " %dx/%dx/%dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C, MAX_TURBO_3C, MAX_TURBO_4C); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:260: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 (string_ptr1, " Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 Cores is"); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:261: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 (string_ptr2, " %dx/%dx/%dx/%dx/%dx/%dx ", MAX_TURBO_1C, MAX_TURBO_2C, MAX_TURBO_3C, MAX_TURBO_4C, data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:622: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 (old_val_CORE, new_val_CORE, data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:624: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 (old_val_REF, new_val_REF, sizeof (*old_val_REF) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:625: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 (old_val_C3, new_val_C3, sizeof (*old_val_C3) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:626: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 (old_val_C6, new_val_C6, sizeof (*old_val_C6) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:629:6: [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 (old_val_C7, new_val_C7, sizeof (*old_val_C7) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:632: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 (tvstart, tvstop, sizeof (*tvstart) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:633: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 (old_TSC, new_TSC, sizeof (*old_TSC) * numCPUs); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:717: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 HT_ON_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:129: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 (vendor_string, &c, 4); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:130: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 (vendor_string + 4, &d, 4); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:131: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 (vendor_string + 8, &e, 4); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:260: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 msr_file_name[64]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:264: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 (msr_file_name, "/dev/cpu/%d/msr", cpu); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:265: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 (msr_file_name, O_RDONLY); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:317: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 msr_file_name[64]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:319: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 (msr_file_name, "/dev/cpu/%d/msr", cpu); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:320: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 (msr_file_name, O_WRONLY); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:384: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 vendor_string[13]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:507:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). tmp_file = fopen ("/tmp/cpufreq.txt", "r"); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp: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 tmp_str[30]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:520: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:532: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:544: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). return(atoi(t1)); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:626: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 socket_list[200]=""; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:639:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen("/proc/cpuinfo","r"); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:640: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 strinfo[200]; data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/perfmon-i7z.cpp:336:9: [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(lvalue, "a+"); data/i7z-0.27.2+git2013.10.12-g5023138/test-scripts/test_cpuid_issue.cpp:42: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 (vendor_string, &b, 4); data/i7z-0.27.2+git2013.10.12-g5023138/test-scripts/test_cpuid_issue.cpp:43: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 (&vendor_string[4], &d, 4); data/i7z-0.27.2+git2013.10.12-g5023138/test-scripts/test_cpuid_issue.cpp:44: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 (&vendor_string[8], &c, 4); data/i7z-0.27.2+git2013.10.12-g5023138/test-scripts/test_cpuid_issue.cpp:54: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 vendor_string[13]; data/i7z-0.27.2+git2013.10.12-g5023138/helper_functions.c:176:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (10000); data/i7z-0.27.2+git2013.10.12-g5023138/i7z.c:470:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(log_file_name, optarg, MAX_FILENAME_LENGTH-3); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:732:13: [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 (HT_ON_str, "Hyper Threading ON\0", 30); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Dual_Socket.c:735:13: [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 (HT_ON_str, "Hyper Threading OFF\0", 30); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:738:13: [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 (HT_ON_str, "Hyper Threading ON\0", 30); data/i7z-0.27.2+git2013.10.12-g5023138/i7z_Single_Socket.c:741:13: [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 (HT_ON_str, "Hyper Threading OFF\0", 30); data/i7z-0.27.2+git2013.10.12-g5023138/perfmon-i7z/helper_functions.cpp:201:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (100000); ANALYSIS SUMMARY: Hits = 158 Lines analyzed = 5946 in approximately 0.79 seconds (7558 lines/second) Physical Source Lines of Code (SLOC) = 3907 Hits@level = [0] 250 [1] 7 [2] 126 [3] 2 [4] 23 [5] 0 Hits@level+ = [0+] 408 [1+] 158 [2+] 151 [3+] 25 [4+] 23 [5+] 0 Hits/KSLOC@level+ = [0+] 104.428 [1+] 40.4402 [2+] 38.6486 [3+] 6.39877 [4+] 5.88687 [5+] 0 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.