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/rstatd-4.0.1/rstat_svc.c Examining data/rstatd-4.0.1/rstat_xdr.c Examining data/rstatd-4.0.1/rstat_proc.c Examining data/rstatd-4.0.1/getdata22.c Examining data/rstatd-4.0.1/getdata24.c Examining data/rstatd-4.0.1/getdata26.c Examining data/rstatd-4.0.1/config.h Examining data/rstatd-4.0.1/getdata22.h Examining data/rstatd-4.0.1/getdata24.h Examining data/rstatd-4.0.1/getdata26.h Examining data/rstatd-4.0.1/getdata.h Examining data/rstatd-4.0.1/rstat_proc.h Examining data/rstatd-4.0.1/rstat_clnt.c Examining data/rstatd-4.0.1/rstat_main.c Examining data/rstatd-4.0.1/getdata.c Examining data/rstatd-4.0.1/rup.c Examining data/rstatd-4.0.1/rsysinfo.c FINAL RESULTS: data/rstatd-4.0.1/getdata24.c:64:3: [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. sscanf(line, " %*d %*d %*d %s " data/rstatd-4.0.1/getdata26.c:38:3: [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. sscanf(line, " %*d %*d %s " data/rstatd-4.0.1/rsysinfo.c:82:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(days_buf, "%3d day%s, ", host_uptime.tm_yday, data/rstatd-4.0.1/rup.c:112:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( data/rstatd-4.0.1/rup.c:154:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(users_buf, "%3d user%s, ", host_stat->users, data/rstatd-4.0.1/rsysinfo.c:182:13: [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,"h?v")) != EOF) data/rstatd-4.0.1/rup.c:333:13: [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,"h?uv")) != EOF) data/rstatd-4.0.1/getdata.c:25:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *patterns[PATTERNS] = { data/rstatd-4.0.1/getdata.c:58: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[1024]; data/rstatd-4.0.1/getdata.c:63:22: [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 == (stat = fopen("/proc/stat", "r"))) { data/rstatd-4.0.1/getdata.c:99: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[1024]; data/rstatd-4.0.1/getdata.c:100:22: [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 == (stat = fopen("/proc/stat", "r"))) { data/rstatd-4.0.1/getdata.c:127:20: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (NULL == (fp = fopen("/proc/loadavg", "r"))) { data/rstatd-4.0.1/getdata.c:150:13: [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 ((ufd = open(_PATH_UTMP, O_RDONLY)) < 0) { data/rstatd-4.0.1/getdata.c:165: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[BUFSIZ]; data/rstatd-4.0.1/getdata.c:167: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("/proc/uptime", O_RDONLY)) < 0) { data/rstatd-4.0.1/getdata.c:189: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[1024]; data/rstatd-4.0.1/getdata.c:195: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 ((fp = fopen("/proc/net/dev","r")) == NULL) { data/rstatd-4.0.1/getdata22.c:22: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 buffer[1024]; data/rstatd-4.0.1/getdata22.c:24: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). stat = fopen("/proc/stat", "r"); data/rstatd-4.0.1/getdata24.c:44: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 buffer[128]; data/rstatd-4.0.1/getdata24.c:47: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/rstatd-4.0.1/getdata24.c:48: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[128]; data/rstatd-4.0.1/getdata24.c:52:15: [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). partitions = fopen("/proc/partitions", "r"); data/rstatd-4.0.1/getdata26.c:25: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/rstatd-4.0.1/getdata26.c:26: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[128]; data/rstatd-4.0.1/getdata26.c:30: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). diskstat = fopen("/proc/diskstats", "r"); data/rstatd-4.0.1/getdata26.c:53: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[1024]; data/rstatd-4.0.1/getdata26.c:57: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). vmstat = fopen("/proc/vmstat", "r"); data/rstatd-4.0.1/rsysinfo.c:42:6: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. void bcopy(); data/rstatd-4.0.1/rsysinfo.c:59: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 days_buf[16]; data/rstatd-4.0.1/rsysinfo.c:60:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char hours_buf[16]; data/rstatd-4.0.1/rsysinfo.c:88:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(hours_buf, "%2d:%02d, ", data/rstatd-4.0.1/rsysinfo.c:92:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(hours_buf, "%2d mins, ", host_uptime.tm_min); data/rstatd-4.0.1/rsysinfo.c:201:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(hp->h_addr,(caddr_t)&server_addr.sin_addr, hp->h_length); data/rstatd-4.0.1/rup.c:43:6: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. void bcopy(); data/rstatd-4.0.1/rup.c:110:8: [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(hours_buf, "%2d:%02d, ", hours, mins); data/rstatd-4.0.1/rup.c:126: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 days_buf[16]; data/rstatd-4.0.1/rup.c:127: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 hours_buf[16]; data/rstatd-4.0.1/rup.c:128: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 users_buf[16]; data/rstatd-4.0.1/rup.c:175: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 days_buf[16]; data/rstatd-4.0.1/rup.c:176: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 hours_buf[16]; data/rstatd-4.0.1/rup.c:354:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(hp->h_addr,(caddr_t)&server_addr.sin_addr, hp->h_length); data/rstatd-4.0.1/getdata.c:153:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u)) { data/rstatd-4.0.1/getdata.c:171:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read(fd,(char *)&buf,sizeof(buf))) < 0) { ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 3103 in approximately 0.10 seconds (31845 lines/second) Physical Source Lines of Code (SLOC) = 2444 Hits@level = [0] 67 [1] 2 [2] 36 [3] 2 [4] 5 [5] 0 Hits@level+ = [0+] 112 [1+] 45 [2+] 43 [3+] 7 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 45.8265 [1+] 18.4124 [2+] 17.5941 [3+] 2.86416 [4+] 2.04583 [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.