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/mako-notifier-1.4.1/cairo-pixbuf.c Examining data/mako-notifier-1.4.1/config.c Examining data/mako-notifier-1.4.1/criteria.c Examining data/mako-notifier-1.4.1/dbus/dbus.c Examining data/mako-notifier-1.4.1/dbus/mako.c Examining data/mako-notifier-1.4.1/dbus/xdg.c Examining data/mako-notifier-1.4.1/event-loop.c Examining data/mako-notifier-1.4.1/icon.c Examining data/mako-notifier-1.4.1/include/cairo-pixbuf.h Examining data/mako-notifier-1.4.1/include/config.h Examining data/mako-notifier-1.4.1/include/criteria.h Examining data/mako-notifier-1.4.1/include/dbus.h Examining data/mako-notifier-1.4.1/include/enum.h Examining data/mako-notifier-1.4.1/include/event-loop.h Examining data/mako-notifier-1.4.1/include/icon.h Examining data/mako-notifier-1.4.1/include/mako.h Examining data/mako-notifier-1.4.1/include/notification.h Examining data/mako-notifier-1.4.1/include/pool-buffer.h Examining data/mako-notifier-1.4.1/include/render.h Examining data/mako-notifier-1.4.1/include/string-util.h Examining data/mako-notifier-1.4.1/include/types.h Examining data/mako-notifier-1.4.1/include/wayland.h Examining data/mako-notifier-1.4.1/main.c Examining data/mako-notifier-1.4.1/notification.c Examining data/mako-notifier-1.4.1/pool-buffer.c Examining data/mako-notifier-1.4.1/render.c Examining data/mako-notifier-1.4.1/string-util.c Examining data/mako-notifier-1.4.1/types.c Examining data/mako-notifier-1.4.1/wayland.c FINAL RESULTS: data/mako-notifier-1.4.1/config.c:512:17: [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 path && access(path, R_OK) != -1; data/mako-notifier-1.4.1/config.c:527:3: [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(config_home, home); data/mako-notifier-1.4.1/string-util.c:10:13: [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. int size = vsnprintf(NULL, 0, fmt, args); data/mako-notifier-1.4.1/string-util.c:23:2: [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(text, size + 1, fmt, args); data/mako-notifier-1.4.1/config.c:521: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. if (!getenv("XDG_CONFIG_HOME")) { data/mako-notifier-1.4.1/config.c:522:16: [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. char *home = getenv("HOME"); data/mako-notifier-1.4.1/config.c:686:11: [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. int c = getopt_long(argc, argv, "hc:", long_options, &option_index); data/mako-notifier-1.4.1/config.c:706:11: [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. int c = getopt_long(argc, argv, "hc:", long_options, &option_index); data/mako-notifier-1.4.1/config.c:344: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 current_specifier[3] = {0}; data/mako-notifier-1.4.1/config.c:356: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(¤t_specifier, format_pos, 2); data/mako-notifier-1.4.1/config.c:358:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(target_format_pos, format_pos, 2); data/mako-notifier-1.4.1/config.c:526: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 config_home[strlen(home) + strlen("/.config") + 1]; data/mako-notifier-1.4.1/config.c:528: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(config_home, "/.config"); data/mako-notifier-1.4.1/config.c:558: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). FILE *f = fopen(path, "r"); data/mako-notifier-1.4.1/criteria.c:112: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 token[token_max_length]; data/mako-notifier-1.4.1/criteria.c:357: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(&criteria->spec, spec, sizeof(struct mako_criteria_spec)); data/mako-notifier-1.4.1/notification.c:168: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(buf + len, replacement, replacement_len); data/mako-notifier-1.4.1/notification.c:223: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(buf + len, last, tail_len + 1); data/mako-notifier-1.4.1/notification.c:231:4: [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(buf + len, last, chunk_len); data/mako-notifier-1.4.1/notification.c:257: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(buf + len, value, value_len); data/mako-notifier-1.4.1/types.c:206: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 token[token_max_length]; data/mako-notifier-1.4.1/config.c:308:34: [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). target->format = calloc(1, (2 * strlen(VALID_FORMAT_SPECIFIERS)) + 1); data/mako-notifier-1.4.1/config.c:526: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). char config_home[strlen(home) + strlen("/.config") + 1]; data/mako-notifier-1.4.1/config.c:526: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). char config_home[strlen(home) + strlen("/.config") + 1]; data/mako-notifier-1.4.1/config.c:583:12: [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 (line[strlen(line) - 1] == '\n') { data/mako-notifier-1.4.1/config.c:584: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). line[strlen(line) - 1] = '\0'; data/mako-notifier-1.4.1/config.c:587: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). if (line[0] == '[' && line[strlen(line) - 1] == ']') { data/mako-notifier-1.4.1/config.c:589:32: [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). section = strndup(line + 1, strlen(line) - 2); data/mako-notifier-1.4.1/criteria.c:111: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). int token_max_length = strlen(string) + 1; data/mako-notifier-1.4.1/event-loop.c:166:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t n = read(timer_fd, &expirations, sizeof(expirations)); data/mako-notifier-1.4.1/icon.c:24:6: [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(path) == 0) { data/mako-notifier-1.4.1/icon.c:96:28: [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). char *icon_path = malloc(strlen(icon_name) + 1 - strlen("file://")); data/mako-notifier-1.4.1/icon.c:96:52: [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). char *icon_path = malloc(strlen(icon_name) + 1 - strlen("file://")); data/mako-notifier-1.4.1/icon.c:101:37: [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). url_decode(icon_path, icon_name + strlen("file://")); data/mako-notifier-1.4.1/icon.c:128:7: [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(theme_path) == 0) { data/mako-notifier-1.4.1/icon.c:150: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). relative_path += strlen(theme_path); data/mako-notifier-1.4.1/notification.c:132:19: [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 src_len = strlen(src); data/mako-notifier-1.4.1/notification.c:166:29: [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 replacement_len = strlen(replacement); data/mako-notifier-1.4.1/notification.c:221:22: [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 tail_len = strlen(last); data/mako-notifier-1.4.1/notification.c:255:16: [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). value_len = strlen(value); data/mako-notifier-1.4.1/pool-buffer.c:28:19: [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). randname(name + strlen(name) - 6); data/mako-notifier-1.4.1/types.c:45: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). size_t len = strlen(string); data/mako-notifier-1.4.1/types.c:205:28: [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 token_max_length = strlen(string) + 1; ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 5114 in approximately 0.12 seconds (41410 lines/second) Physical Source Lines of Code (SLOC) = 4052 Hits@level = [0] 60 [1] 22 [2] 13 [3] 4 [4] 4 [5] 0 Hits@level+ = [0+] 103 [1+] 43 [2+] 21 [3+] 8 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 25.4195 [1+] 10.612 [2+] 5.18263 [3+] 1.97433 [4+] 0.987167 [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.