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/earlyoom-1.6/contrib/membomb/membomb.c Examining data/earlyoom-1.6/contrib/zombie.c Examining data/earlyoom-1.6/globals.c Examining data/earlyoom-1.6/globals.h Examining data/earlyoom-1.6/kill.c Examining data/earlyoom-1.6/kill.h Examining data/earlyoom-1.6/main.c Examining data/earlyoom-1.6/meminfo.c Examining data/earlyoom-1.6/meminfo.h Examining data/earlyoom-1.6/msg.c Examining data/earlyoom-1.6/msg.h FINAL RESULTS: data/earlyoom-1.6/kill.c:58:5: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl("/usr/bin/dbus-send", "dbus-send", "--system", "/", "net.nuetzlich.SystemNotifications.Notify", data/earlyoom-1.6/kill.c:102:29: [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. print_mem_stats(printf, m); data/earlyoom-1.6/main.c:393:29: [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. print_mem_stats(printf, m); data/earlyoom-1.6/meminfo.c:260:48: [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. void print_mem_stats(int __attribute__((format(printf, 1, 2))) (*out_func)(const char* fmt, ...), const meminfo_t m) data/earlyoom-1.6/msg.c:22:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(f, fmt, vl); data/earlyoom-1.6/msg.h:16:69: [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. int fatal(int code, char* fmt, ...) __attribute__((noreturn, format(printf, 2, 3))); data/earlyoom-1.6/msg.h:17:54: [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. int warn(const char* fmt, ...) __attribute__((format(printf, 1, 2))); data/earlyoom-1.6/msg.h:18:55: [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. int debug(const char* fmt, ...) __attribute__((format(printf, 1, 2))); data/earlyoom-1.6/main.c:97:17: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long(argc, argv, short_opt, long_opt, NULL)) != -1) { data/earlyoom-1.6/kill.c:50:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char summary2[1024] = { 0 }; data/earlyoom-1.6/kill.c:52:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char body2[1024] = "string:"; data/earlyoom-1.6/kill.c:288:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char notif_args[PATH_MAX + 1000]; data/earlyoom-1.6/main.c:315:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[256]; data/earlyoom-1.6/main.c:319: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). FILE* f = fopen(buf, "w"); data/earlyoom-1.6/meminfo.c:69:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[8192] = { 0 }; data/earlyoom-1.6/meminfo.c:73:14: [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). fd = fopen("/proc/meminfo", "r"); data/earlyoom-1.6/meminfo.c:117:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[256]; data/earlyoom-1.6/meminfo.c:120: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). FILE* f = fopen(buf, "r"); data/earlyoom-1.6/meminfo.c:149:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_LEN] = { 0 }; data/earlyoom-1.6/meminfo.c:151: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). FILE* f = fopen(path, "r"); data/earlyoom-1.6/meminfo.c:192:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_LEN] = { 0 }; data/earlyoom-1.6/meminfo.c:194: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). FILE* f = fopen(path, "r"); data/earlyoom-1.6/meminfo.c:215:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_LEN] = { 0 }; data/earlyoom-1.6/meminfo.c:230:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_LEN] = { 0 }; data/earlyoom-1.6/meminfo.c:234: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). FILE* f = fopen(path, "r"); data/earlyoom-1.6/meminfo.h:27:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[PATH_LEN]; data/earlyoom-1.6/msg.c:38:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fmt2[MSG_LEN] = { 0 }; data/earlyoom-1.6/msg.c:109:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MSG_LEN] = { 0 }; data/earlyoom-1.6/msg.h:22:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char err[255]; data/earlyoom-1.6/kill.c:108:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(poll_ms * 1000); data/earlyoom-1.6/kill.c:224: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 (strlen(cur.name) == 0) { data/earlyoom-1.6/main.c:108: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). if (strlen(tuple.err)) { data/earlyoom-1.6/main.c:118: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). if (strlen(tuple.err)) { data/earlyoom-1.6/main.c:127: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). if (strlen(tuple.err)) { data/earlyoom-1.6/main.c:136: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). if (strlen(tuple.err)) { data/earlyoom-1.6/main.c:398:9: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(sleep_ms * 1000); data/earlyoom-1.6/meminfo.c:29: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). long long val = strtoll(hit + strlen(name), NULL, 10); data/earlyoom-1.6/msg.c:28: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 (fmt[strlen(fmt) - 1] == '\n') { data/earlyoom-1.6/msg.c:111: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). if (strlen(optarg) > (sizeof(buf) - 1)) { data/earlyoom-1.6/msg.c:113:46: [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). "argument too long (%zu bytes)", strlen(optarg)); data/earlyoom-1.6/msg.c:116:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, optarg, sizeof(buf) - 1); data/earlyoom-1.6/msg.c:129: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). if (strlen(tuple.err)) { data/earlyoom-1.6/msg.c:135: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 (strlen(tuple.err)) { data/earlyoom-1.6/msg.c:166: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). size_t len = strlen(str); ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 1373 in approximately 0.10 seconds (13630 lines/second) Physical Source Lines of Code (SLOC) = 1039 Hits@level = [0] 39 [1] 15 [2] 20 [3] 1 [4] 8 [5] 0 Hits@level+ = [0+] 83 [1+] 44 [2+] 29 [3+] 9 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 79.8845 [1+] 42.3484 [2+] 27.9115 [3+] 8.66218 [4+] 7.69971 [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.