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/mrtgutils-0.8.3/mrtg-apache.c Examining data/mrtgutils-0.8.3/mrtg-ip-acct.c Examining data/mrtgutils-0.8.3/mrtg-sensors.c Examining data/mrtgutils-0.8.3/uptime.h Examining data/mrtgutils-0.8.3/util.c Examining data/mrtgutils-0.8.3/util.h Examining data/mrtgutils-0.8.3/uptime.c Examining data/mrtgutils-0.8.3/mrtg-uptime.c Examining data/mrtgutils-0.8.3/mrtg-load.c FINAL RESULTS: data/mrtgutils-0.8.3/mrtg-apache.c:14:31: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DIE(fmt, arg...) do { fprintf(stderr, fmt, ##arg); exit(1); } while (0); data/mrtgutils-0.8.3/mrtg-apache.c:39: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(buf, sizeof(buf), REQUEST, statusdir); data/mrtgutils-0.8.3/uptime.c:67:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos = sprintf(buf, " %2d:%02d%s ", data/mrtgutils-0.8.3/uptime.c:79:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "%d day%s, ", updays, (updays != 1) ? "s" : ""); data/mrtgutils-0.8.3/uptime.c:100:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s"); data/mrtgutils-0.8.3/mrtg-apache.c:75: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 ((c = getopt(argc, argv, "qp:m:s:")) > 0) { data/mrtgutils-0.8.3/mrtg-load.c:46: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 ((c = getopt(argc, argv, "m:l:")) > 0) { data/mrtgutils-0.8.3/mrtg-sensors.c:78: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, "m:")) > 0) { data/mrtgutils-0.8.3/mrtg-uptime.c:43: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 ((c = getopt(argc, argv, "t:m:u:c:")) > 0) { data/mrtgutils-0.8.3/mrtg-apache.c:21: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 buf[2048], input[256], *p; data/mrtgutils-0.8.3/mrtg-apache.c:48:7: [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, input, bytesread); data/mrtgutils-0.8.3/mrtg-apache.c:78:24: [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). case 'p': port = atoi(optarg); break; data/mrtgutils-0.8.3/mrtg-apache.c:79:30: [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). case 'm': multiplier = atoi(optarg); break; data/mrtgutils-0.8.3/mrtg-ip-acct.c:10: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 buf[1024]; data/mrtgutils-0.8.3/mrtg-ip-acct.c:15: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/net/dev", "r"); data/mrtgutils-0.8.3/mrtg-uptime.c:36: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 typ [2] = {'s','i'}; data/mrtgutils-0.8.3/uptime.c:11:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[128]; data/mrtgutils-0.8.3/uptime.c:21: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). f = fopen("/proc/uptime", "r"); data/mrtgutils-0.8.3/uptime.c:41: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). f = fopen("/proc/loadavg", "r"); data/mrtgutils-0.8.3/uptime.c:76:3: [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 (buf, "up "); data/mrtgutils-0.8.3/uptime.c:85:12: [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. pos += sprintf(buf + pos, "%2d:%02d, ", uphours, upminutes); data/mrtgutils-0.8.3/uptime.c:87:12: [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. pos += sprintf(buf + pos, "%d min, ", upminutes); data/mrtgutils-0.8.3/uptime.c:104:10: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. pos += sprintf(buf + pos, " load average: %.2f, %.2f, %.2f", data/mrtgutils-0.8.3/util.c:11: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 hostname[255]; data/mrtgutils-0.8.3/mrtg-apache.c:43:21: [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 (write(s, buf, strlen(buf)+1) < 0) PERROR("write"); data/mrtgutils-0.8.3/mrtg-apache.c:46:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((bytesread = read(s, input, sizeof(input))) > 0) { data/mrtgutils-0.8.3/mrtg-ip-acct.c:23:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strncmp(dev, p, strlen(dev)) == 0) { ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 606 in approximately 0.03 seconds (23092 lines/second) Physical Source Lines of Code (SLOC) = 497 Hits@level = [0] 37 [1] 3 [2] 15 [3] 4 [4] 5 [5] 0 Hits@level+ = [0+] 64 [1+] 27 [2+] 24 [3+] 9 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 128.773 [1+] 54.326 [2+] 48.2897 [3+] 18.1087 [4+] 10.0604 [5+] 0 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.