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/libstatgrab-0.92/tests/single_threaded/diff_stats.c Examining data/libstatgrab-0.92/tests/single_threaded/full_stats.c Examining data/libstatgrab-0.92/tests/testlib/testlib.h Examining data/libstatgrab-0.92/tests/testlib/opt.c Examining data/libstatgrab-0.92/tests/testlib/routines.c Examining data/libstatgrab-0.92/tests/testlib/err.c Examining data/libstatgrab-0.92/tests/multi_threaded/diff_stats.c Examining data/libstatgrab-0.92/tests/multi_threaded/full_stats.c Examining data/libstatgrab-0.92/src/statgrab/statgrab.c Examining data/libstatgrab-0.92/src/saidar/saidar.c Examining data/libstatgrab-0.92/src/libstatgrab/error.c Examining data/libstatgrab-0.92/src/libstatgrab/globals.c Examining data/libstatgrab-0.92/src/libstatgrab/trace.h Examining data/libstatgrab-0.92/src/libstatgrab/win32.c Examining data/libstatgrab-0.92/src/libstatgrab/error.h Examining data/libstatgrab-0.92/src/libstatgrab/swap_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/vector.c Examining data/libstatgrab-0.92/src/libstatgrab/process_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/load_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/tools.c Examining data/libstatgrab-0.92/src/libstatgrab/vector.h Examining data/libstatgrab-0.92/src/libstatgrab/os_info.c Examining data/libstatgrab-0.92/src/libstatgrab/tools.h Examining data/libstatgrab-0.92/src/libstatgrab/win32.h Examining data/libstatgrab-0.92/src/libstatgrab/network_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/memory_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/globals.h Examining data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/disk_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/page_stats.c Examining data/libstatgrab-0.92/src/libstatgrab/user_stats.c Examining data/libstatgrab-0.92/examples/filesys_snapshot.c Examining data/libstatgrab-0.92/examples/network_iface_stats.c Examining data/libstatgrab-0.92/examples/process_stats.c Examining data/libstatgrab-0.92/examples/load_stats.c Examining data/libstatgrab-0.92/examples/cpu_usage.c Examining data/libstatgrab-0.92/examples/process_snapshot.c Examining data/libstatgrab-0.92/examples/os_info.c Examining data/libstatgrab-0.92/examples/vm_stats.c Examining data/libstatgrab-0.92/examples/helpers.h Examining data/libstatgrab-0.92/examples/helpers.c Examining data/libstatgrab-0.92/examples/page_stats.c Examining data/libstatgrab-0.92/examples/user_list.c Examining data/libstatgrab-0.92/examples/disk_traffic.c Examining data/libstatgrab-0.92/examples/valid_filesystems.c Examining data/libstatgrab-0.92/examples/network_traffic.c FINAL RESULTS: data/libstatgrab-0.92/src/libstatgrab/tools.c:127:8: [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. x = readlink(dir_dname, file_name, sizeof(file_name)-1); /* ensure no buffer override */ data/libstatgrab-0.92/examples/helpers.c:116:12: [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. printed = vsnprintf( buf, sizeof(buf), fmt, ap); data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:433:8: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if( sscanf(line, "%s %lu %s %s %s", fstype, &i, mnt_helper, filesys_helper, remote) < 4 ) { data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1855:12: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. int nr = sscanf(line_buf, format, name, &rsect, &wsect); data/libstatgrab-0.92/src/libstatgrab/error.c:88:3: [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( error_glob->error_arg, sizeof(error_glob->error_arg), arg, ap ); data/libstatgrab-0.92/src/libstatgrab/error.c:91:3: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf( error_glob->error_arg, arg, ap ); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:480:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(first.name, FIRST_NETINTERFACE); data/libstatgrab-0.92/src/libstatgrab/os_info.c:461:6: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if((fscanf(f,TIME_T_SCANF_FMT,&host_info_buf->uptime)) != 1){ data/libstatgrab-0.92/src/libstatgrab/os_info.c:470:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if( access( "/proc/sys/kernel/vsyscall64", F_OK ) == 0 || data/libstatgrab-0.92/src/libstatgrab/os_info.c:471:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access( "/proc/sys/abi/vsyscall32", F_OK ) == 0 ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:230:12: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if( 0 != sscanf(dir_entry->d_name, FMT_PID_T, &pid) ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:377: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/psinfo", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:423: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/usage", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:443:8: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if( ( fscanf(f, FMT_TIME_T " %*d", &uptime) ) != 1 ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:472: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/comm", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:506:4: [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(proc_stat_fmt, sizeof(proc_stat_fmt), proc_stat_fmt_base, comm_jmp); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:509: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/stat", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:520:9: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. rc = fscanf(f, proc_stat_fmt, data/libstatgrab-0.92/src/libstatgrab/process_stats.c:526:9: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. rc = fscanf(f, proc_stat_fmt_default, data/libstatgrab-0.92/src/libstatgrab/process_stats.c:584: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/status", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:625: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(filename, MAX_FILE_LENGTH, PROC_LOCATION "/" FMT_PID_T "/cmdline", pids_in_proc_dir->items[pid_item]); data/libstatgrab-0.92/src/libstatgrab/tools.c:710: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( path, R_OK ); data/libstatgrab-0.92/src/libstatgrab/trace.h:110:41: [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 PANIC_LOG_FMT(module, ...) do { fprintf( stderr, "panic condition: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d" REST(__VA_ARGS__), __FILE__, __LINE__); exit(255); } while(0) data/libstatgrab-0.92/src/libstatgrab/trace.h:113:36: [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 ERROR_LOG_FMT(module, ...) fprintf(stderr, "error: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d\n" REST(__VA_ARGS__), __FILE__, __LINE__) data/libstatgrab-0.92/src/libstatgrab/trace.h:116:35: [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 WARN_LOG_FMT(module, ...) fprintf(stderr, "warning: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d\n" REST(__VA_ARGS__), __FILE__, __LINE__) data/libstatgrab-0.92/src/libstatgrab/trace.h:119:35: [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 INFO_LOG_FMT(module, ...) fprintf(stderr, "info: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d\n" REST(__VA_ARGS__), __FILE__, __LINE__) data/libstatgrab-0.92/src/libstatgrab/trace.h:122:36: [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 DEBUG_LOG_FMT(module, ...) fprintf(stderr, "debug: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d\n" REST(__VA_ARGS__), __FILE__, __LINE__) data/libstatgrab-0.92/src/libstatgrab/trace.h:125:36: [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 TRACE_LOG_FMT(module, ...) fprintf(stderr, "trace: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d\n" REST(__VA_ARGS__), __FILE__, __LINE__) data/libstatgrab-0.92/src/libstatgrab/trace.h:131:41: [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 PANIC_LOG_FMT(module, ...) do { fprintf( stderr, "panic condition: " FIRST(__VA_ARGS__) " in statgrab." module " at %s:%d" REST(__VA_ARGS__), __FILE__, __LINE__); exit(255); } while(0) data/libstatgrab-0.92/src/libstatgrab/win32.c:193:14: [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). list[*n] = strcpy(list[*n], thisinstance); data/libstatgrab-0.92/src/libstatgrab/win32.c:257:4: [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, sizeof(tmp), PDH_DISKIOREAD, diskio_names[i]); data/libstatgrab-0.92/src/libstatgrab/win32.c:260:4: [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, sizeof(tmp), PDH_DISKIOWRITE, diskio_names[i]); data/libstatgrab-0.92/src/statgrab/statgrab.c:774:3: [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(" "FMT_TIME_T, graphite_ts); data/libstatgrab-0.92/tests/testlib/err.c:85:12: [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. printed = vsnprintf( buf, sizeof(buf), fmt, ap); data/libstatgrab-0.92/examples/cpu_usage.c:67: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, "d:")) != -1){ data/libstatgrab-0.92/examples/disk_traffic.c:77: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, "d:bkm")) != -1){ data/libstatgrab-0.92/examples/load_stats.c:57: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, "d:")) != -1){ data/libstatgrab-0.92/examples/network_traffic.c:77: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, "d:bkm")) != -1){ data/libstatgrab-0.92/examples/page_stats.c:57: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, "d:")) != -1){ data/libstatgrab-0.92/examples/process_stats.c:57: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, "d:")) != -1){ data/libstatgrab-0.92/examples/user_list.c:56: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, "d:")) != -1){ data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1041:8: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. p = realpath(fs_ptr[num_fs].device_canonical, lnktgt); data/libstatgrab-0.92/src/libstatgrab/tools.c:720:7: [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. p = getenv(env_name); data/libstatgrab-0.92/src/libstatgrab/tools.c:734:11: [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((p = getenv(proppath))) { data/libstatgrab-0.92/src/saidar/saidar.c:833: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, "d:F:cvh")) != -1){ data/libstatgrab-0.92/src/saidar/saidar.c:835: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, "d:F:vh")) != -1){ data/libstatgrab-0.92/src/statgrab/statgrab.c:1026:11: [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. int c = getopt(argc, argv, "lbmrR:unsot:pf:F:KMG"); data/libstatgrab-0.92/tests/testlib/opt.c:48:15: [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( (ch = getopt(argc, argv, optlst)) >= 0 ) { data/libstatgrab-0.92/examples/cpu_usage.c:70:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/disk_traffic.c:80:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/helpers.c:114: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[4096]; data/libstatgrab-0.92/examples/load_stats.c:60:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/network_traffic.c:80:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/page_stats.c:60:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/process_stats.c:60:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/user_list.c:59:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/examples/user_list.c:81: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 ltbuf[256]; data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:78:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[1024]; data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:208: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). if ((f=fopen("/proc/stat", "r" ))==NULL) { data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:377: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 name[FSTYPSZ]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:424: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). fh = fopen("/etc/vfs", "r"); data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:426: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 line[1024]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:429: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 fstype[16], mnt_helper[PATH_MAX], filesys_helper[PATH_MAX], remote[16]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:469:21: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( NULL != ( fh = fopen( "/proc/filesystems", "r" ) ) ) { data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:473: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 line[4096]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:654:2: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. TCHAR volume_name_buf[BUFSIZE]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:658:2: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. TCHAR filesys_name_buf[BUFSIZE]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:663: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 drive[4] = " :\\"; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:801: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[4096]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1039: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 lnktgt[PATH_MAX+1], *p; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1307: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 fullpathbuf[1024] = {0}; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1326:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line_buf[LINE_BUF_SIZE]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1457:24: [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. if(NULL == valbp) { char valbuf[PATH_MAX]; \ data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1836:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen("/proc/diskstats", "r"); data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1840: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). f = fopen("/proc/partitions", "r"); data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1852: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 name[100]; data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:1912: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). f = fopen("/proc/stat", "r"); data/libstatgrab-0.92/src/libstatgrab/error.c:35: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_arg[ERROR_ARG_MAX]; data/libstatgrab-0.92/src/libstatgrab/error.c:303: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 errno_buf[128] = { '\0' }; data/libstatgrab-0.92/src/libstatgrab/memory_stats.c:92:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *line_ptr, line_buf[LINE_BUF_SIZE]; data/libstatgrab-0.92/src/libstatgrab/memory_stats.c:213:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((f = fopen("/proc/meminfo", "r")) == NULL) { data/libstatgrab-0.92/src/libstatgrab/network_stats.c: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 name_buf[24]; data/libstatgrab-0.92/src/libstatgrab/network_stats.c:263:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[1024]; data/libstatgrab-0.92/src/libstatgrab/network_stats.c:275: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[5]; data/libstatgrab-0.92/src/libstatgrab/network_stats.c:288: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("/dev/dlpi", O_RDWR)) < 0) { data/libstatgrab-0.92/src/libstatgrab/network_stats.c:321: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 ((u_char*) ppa_area, &(((u_char*) ctrl_area)[ppa_ack->dl_offset]), ppa_ack->dl_length); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:590:4: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f=fopen("/proc/net/dev", "r"); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:722:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[8096]; data/libstatgrab-0.92/src/libstatgrab/network_stats.c:728: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[5]; data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1022:34: [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. ifr = (struct ifreq *)&(((char *)ifr)[_SIZEOF_ADDR_IFREQ(*ifr)]) ) data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1039:34: [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. ifr = (struct ifreq *)&(((char *)ifr)[_SIZEOF_ADDR_IFREQ(*ifr)]) ) data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1242:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen("/proc/net/dev", "r"); data/libstatgrab-0.92/src/libstatgrab/os_info.c:64: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[10]; data/libstatgrab-0.92/src/libstatgrab/os_info.c:194: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[10]; data/libstatgrab-0.92/src/libstatgrab/os_info.c:218: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 arch_name[16]; data/libstatgrab-0.92/src/libstatgrab/os_info.c:456: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). if ((f=fopen("/proc/uptime", "r")) == NULL) { data/libstatgrab-0.92/src/libstatgrab/page_stats.c:40:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line_buf[LINE_BUF_SIZE]; data/libstatgrab-0.92/src/libstatgrab/page_stats.c:90:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((f = fopen("/proc/vmstat", "r")) != NULL) { data/libstatgrab-0.92/src/libstatgrab/page_stats.c:115: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). else if ((f = fopen("/proc/stat", "r")) != NULL) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:309: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 filename[MAX_FILE_LENGTH]; data/libstatgrab-0.92/src/libstatgrab/process_stats.c:312: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 read_buf[READBUF_LENGTH+1]; data/libstatgrab-0.92/src/libstatgrab/process_stats.c:313:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char proc_stat_fmt[sizeof proc_stat_fmt_base]; data/libstatgrab-0.92/src/libstatgrab/process_stats.c:325: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 filename[MAX_FILE_LENGTH]; data/libstatgrab-0.92/src/libstatgrab/process_stats.c:378: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). if( ( f = fopen(filename, "r") ) == NULL ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:424: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). if( ( f = fopen(filename, "r") ) != NULL ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:440:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( ( f = fopen(PROC_LOCATION "/uptime", "r") ) == NULL ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:473: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). if( ( f = fopen(filename, "r") ) == NULL ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:479: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 comm_jmp[32] = { '\0' }; /* procfs documents comm with 16 chars max */ data/libstatgrab-0.92/src/libstatgrab/process_stats.c:510: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). if( ( f = fopen(filename, "r") ) == NULL ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:585:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((f=fopen(filename, "r")) == NULL) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:627:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( ( fd = open(filename, O_RDONLY) ) == -1 ) { data/libstatgrab-0.92/src/libstatgrab/process_stats.c:646: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( proc_stats_ptr[proc_items].proctitle + len, read_buf, rc ); data/libstatgrab-0.92/src/libstatgrab/swap_stats.c:88:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line_buf[LINE_BUF_SIZE]; data/libstatgrab-0.92/src/libstatgrab/swap_stats.c:222:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((f = fopen("/proc/meminfo", "r")) == NULL) { data/libstatgrab-0.92/src/libstatgrab/tools.c:102: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 current_dir[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:103:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char file_name[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:104: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 temp_name[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:105: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 dir_dname[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:149:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char file[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:153: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 tmpnode[MAXPATHLEN + 1]; data/libstatgrab-0.92/src/libstatgrab/tools.c:192: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_name[MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:198: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 driver_list[BIG_ENOUGH][MAXPATHLEN]; data/libstatgrab-0.92/src/libstatgrab/tools.c:528: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(new, src, len); data/libstatgrab-0.92/src/libstatgrab/tools.c:678:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( ( f = fopen(fn, type) ) == NULL ) { data/libstatgrab-0.92/src/libstatgrab/tools.c:716: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 proppath[PATH_MAX]; data/libstatgrab-0.92/src/libstatgrab/user_stats.c:108: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 name[256]; data/libstatgrab-0.92/src/libstatgrab/user_stats.c:283:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((f=fopen(_PATH_UTMP, "r")) == NULL) { data/libstatgrab-0.92/src/libstatgrab/win32.c:232: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[512]; data/libstatgrab-0.92/src/saidar/saidar.c:115: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 string[10]; data/libstatgrab-0.92/src/saidar/saidar.c:141: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 string[10]; data/libstatgrab-0.92/src/saidar/saidar.c:158: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 uptime_str[25]; data/libstatgrab-0.92/src/saidar/saidar.c:279:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cur_time[20]; data/libstatgrab-0.92/src/saidar/saidar.c:289: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[15]; data/libstatgrab-0.92/src/saidar/saidar.c:482: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 name[12]; data/libstatgrab-0.92/src/saidar/saidar.c:524: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 name[20]; data/libstatgrab-0.92/src/saidar/saidar.c:551: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 name[20]; data/libstatgrab-0.92/src/saidar/saidar.c:839:13: [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). delay = atoi(optarg); data/libstatgrab-0.92/src/statgrab/statgrab.c:175: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(p, part, partlen); data/libstatgrab-0.92/src/statgrab/statgrab.c:1059:18: [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). repeat_time = atoi(optarg); data/libstatgrab-0.92/src/statgrab/statgrab.c:1065:25: [2] (integer) atol: 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). float_scale_factor = atol(optarg); data/libstatgrab-0.92/tests/testlib/err.c:83: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[4096]; data/libstatgrab-0.92/tests/testlib/opt.c:30: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 optlst[256] = { '\0' }; data/libstatgrab-0.92/examples/helpers.c:145:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = read(STDIN_FILENO, &ch, 1); data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:213:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( ( ( strncmp( line, "cpu", strlen("cpu" ) ) == 0 ) && isblank(line[strlen("cpu")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:213:73: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( ( ( strncmp( line, "cpu", strlen("cpu" ) ) == 0 ) && isblank(line[strlen("cpu")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:229:39: [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). else if( ( ( strncmp( line, "intr", strlen("intr" ) ) == 0 ) && isblank(line[strlen("intr")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:229:80: [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). else if( ( ( strncmp( line, "intr", strlen("intr" ) ) == 0 ) && isblank(line[strlen("intr")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:239:39: [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). else if( ( ( strncmp( line, "ctxt", strlen("ctxt" ) ) == 0 ) && isblank(line[strlen("ctxt")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:239:80: [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). else if( ( ( strncmp( line, "ctxt", strlen("ctxt" ) ) == 0 ) && isblank(line[strlen("ctxt")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:249:42: [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). else if( ( ( strncmp( line, "softirq", strlen("softirq" ) ) == 0 ) && isblank(line[strlen("softirq")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/cpu_stats.c:249:86: [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). else if( ( ( strncmp( line, "softirq", strlen("softirq" ) ) == 0 ) && isblank(line[strlen("softirq")]) ) ) { data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:371:65: [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). #define CUR_VALID_FS fsnamebuf ? (0 == i) ? fsname : (fsname += strlen(fsname)+1) : int_valid_fs[i] data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:550:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( cvfs && strlen(cvfs) ) { data/libstatgrab-0.92/src/libstatgrab/disk_stats.c:998:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). #define SG_FS_LOOP_ITER p += strlen(p) + 1, rc = getdrvent(p, (1 << DRIVE_FIXED)|(1<<DRIVE_RAMDISK), &mp ) data/libstatgrab-0.92/src/libstatgrab/network_stats.c:766:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, net_ptr->ifa_name, sizeof(ifr.ifr_name)); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:788:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifmed.ifm_name, net_ptr->ifa_name, sizeof(ifmed.ifm_name)-1); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1047:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(iff.ifr_name, ifr->ifr_name, sizeof(iff.ifr_name)); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1122:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(iff.ifr_name, ifr->ifr_name, sizeof(iff.ifr_name)); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1168:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, ksp->ks_name, sizeof(ifr.ifr_name)); data/libstatgrab-0.92/src/libstatgrab/network_stats.c:1283:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); data/libstatgrab-0.92/src/libstatgrab/os_info.c:164: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(a); data/libstatgrab-0.92/src/libstatgrab/os_info.c:165: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). len_b = strlen(b); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:282: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). p += strlen(p); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:489: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). tok_e = read_buf + strlen(read_buf) - 1; data/libstatgrab-0.92/src/libstatgrab/process_stats.c:493: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(comm_jmp, "%*s", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:493:48: [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(comm_jmp, "%*s", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:496:6: [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. strncat(comm_jmp, " ", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:496:48: [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(comm_jmp, " ", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:497:6: [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(comm_jmp, "%*s", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:497:50: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(comm_jmp, "%*s", sizeof(comm_jmp) - strlen(comm_jmp) - 1); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:636:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, read_buf, sizeof(read_buf)); data/libstatgrab-0.92/src/libstatgrab/process_stats.c:830:96: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( size > 1 && ( ( p = adjust_procname_cmndline( proctitle, size - 1 ) ) != NULL ) && 0 != strlen(p) ) { data/libstatgrab-0.92/src/libstatgrab/tools.c:110:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(current_dir, dsk_dir, sizeof current_dir); data/libstatgrab-0.92/src/libstatgrab/tools.c:217:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(device_name, ksp->ks_name, sizeof device_name); data/libstatgrab-0.92/src/libstatgrab/tools.c:247:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(driver_list[x], device_name, sizeof(driver_list[x])); data/libstatgrab-0.92/src/libstatgrab/tools.c:270:42: [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(string && (strncmp(string, linebuf, strlen(string))==0)){ data/libstatgrab-0.92/src/libstatgrab/tools.c:431:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return(dlen + strlen(s)); data/libstatgrab-0.92/src/libstatgrab/tools.c:478: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). newlen = strlen(src) + 1; data/libstatgrab-0.92/src/libstatgrab/tools.c:544: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). len += strlen(*dest); data/libstatgrab-0.92/src/libstatgrab/tools.c:546: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). len += strlen(src); data/libstatgrab-0.92/src/libstatgrab/tools.c:744: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(p, ".properties", PATH_MAX - ( p - proppath )); data/libstatgrab-0.92/src/libstatgrab/tools.c:751:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p = proppath + strlen(proppath); data/libstatgrab-0.92/src/libstatgrab/tools.c:754: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). p -= strlen("/.libs"); data/libstatgrab-0.92/src/libstatgrab/tools.c:755:51: [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((p > proppath) && (0 == strncmp(p, "/.libs", strlen("/.libs")))) data/libstatgrab-0.92/src/libstatgrab/tools.h:146: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). # define NAMLEN(dirent) strlen ((dirent)->d_name) data/libstatgrab-0.92/src/libstatgrab/win32.c:180: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). thisinstance += strlen(thisinstance) + 1) { data/libstatgrab-0.92/src/libstatgrab/win32.c:189:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). list[*n] = sg_malloc(strlen(thisinstance) +1); data/libstatgrab-0.92/src/libstatgrab/win32.c:207:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char *get_diskio(const int no, long long *read, long long *write) data/libstatgrab-0.92/src/libstatgrab/win32.c:215:51: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read_counter_large_int(diskio_rhan[no], read); data/libstatgrab-0.92/src/libstatgrab/win32.h:53:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char *get_diskio(const int no, long long *read, long long *write); data/libstatgrab-0.92/src/libstatgrab/win32.h:54:53: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int get_netio(const int no, char **name, long long *read, long long *write); data/libstatgrab-0.92/src/saidar/saidar.c:294:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(hostname, stats.host_info->hostname, (sizeof(hostname) - 1)); data/libstatgrab-0.92/src/saidar/saidar.c:483:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, disk_io_stat_ptr->disk_name, sizeof(name)); data/libstatgrab-0.92/src/saidar/saidar.c:525:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, network_stat_ptr->interface_name, sizeof(name)); data/libstatgrab-0.92/src/saidar/saidar.c:554:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, disk_stat_ptr->mnt_point, sizeof(name)); data/libstatgrab-0.92/src/statgrab/statgrab.c:159:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += 1 + strlen(part); data/libstatgrab-0.92/src/statgrab/statgrab.c:174: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). partlen = strlen(part); data/libstatgrab-0.92/src/statgrab/statgrab.c:215: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). return strncmp(kn, in, strlen(kn)); data/libstatgrab-0.92/src/statgrab/statgrab.c:329:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). name_list_length += strlen(name) + 1; data/libstatgrab-0.92/src/statgrab/statgrab.c:346:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name_list + pos, name, strlen(name)); data/libstatgrab-0.92/src/statgrab/statgrab.c:346: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). strncpy(name_list + pos, name, strlen(name)); data/libstatgrab-0.92/src/statgrab/statgrab.c:347: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). pos += strlen(name); data/libstatgrab-0.92/src/statgrab/statgrab.c:428: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). if (strlen(name) == 2 && name[1] == ':') data/libstatgrab-0.92/src/statgrab/statgrab.c:635: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). strlen(t->name)) == 0) { data/libstatgrab-0.92/src/statgrab/statgrab.c:796:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (name[strlen(name) - 1] == '.') ANALYSIS SUMMARY: Hits = 205 Lines analyzed = 16647 in approximately 0.44 seconds (37994 lines/second) Physical Source Lines of Code (SLOC) = 12619 Hits@level = [0] 208 [1] 63 [2] 94 [3] 14 [4] 33 [5] 1 Hits@level+ = [0+] 413 [1+] 205 [2+] 142 [3+] 48 [4+] 34 [5+] 1 Hits/KSLOC@level+ = [0+] 32.7284 [1+] 16.2453 [2+] 11.2529 [3+] 3.80379 [4+] 2.69435 [5+] 0.0792456 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.