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/wofi-1.2.1/inc/config.h Examining data/wofi-1.2.1/inc/map.h Examining data/wofi-1.2.1/inc/property_box.h Examining data/wofi-1.2.1/inc/utils.h Examining data/wofi-1.2.1/inc/utils_g.h Examining data/wofi-1.2.1/inc/widget_builder.h Examining data/wofi-1.2.1/inc/widget_builder_api.h Examining data/wofi-1.2.1/inc/wlr-layer-shell-unstable-v1-client-protocol.h Examining data/wofi-1.2.1/inc/wofi.h Examining data/wofi-1.2.1/inc/wofi_api.h Examining data/wofi-1.2.1/inc/xdg-output-unstable-v1-client-protocol.h Examining data/wofi-1.2.1/modes/dmenu.c Examining data/wofi-1.2.1/modes/drun.c Examining data/wofi-1.2.1/modes/run.c Examining data/wofi-1.2.1/proto/wlr-layer-shell-unstable-v1-protocol.c Examining data/wofi-1.2.1/proto/xdg-output-unstable-v1-protocol.c Examining data/wofi-1.2.1/proto/xdg-shell-protocol.c Examining data/wofi-1.2.1/src/config.c Examining data/wofi-1.2.1/src/main.c Examining data/wofi-1.2.1/src/map.c Examining data/wofi-1.2.1/src/property_box.c Examining data/wofi-1.2.1/src/utils.c Examining data/wofi-1.2.1/src/utils_g.c Examining data/wofi-1.2.1/src/widget_builder.c Examining data/wofi-1.2.1/src/wofi.c FINAL RESULTS: data/wofi-1.2.1/modes/drun.c:305: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(full_path, F_OK) == 0) { data/wofi-1.2.1/modes/run.c:73:8: [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(node->line, X_OK) == 0 && S_ISREG(info.st_mode)) || data/wofi-1.2.1/modes/run.c:121:7: [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(full_path, X_OK) == 0 && S_ISREG(info.st_mode) && data/wofi-1.2.1/modes/run.c:206:3: [4] (shell) execvp: 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. execvp(tmp, args); data/wofi-1.2.1/modes/run.c:209:3: [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(cmd, cmd, NULL); data/wofi-1.2.1/src/main.c:103:5: [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(stylesheet, R_OK) == 0) { data/wofi-1.2.1/src/main.c:128:7: [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(color_path, R_OK) == 0) { data/wofi-1.2.1/src/main.c:137:6: [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(entry->line, line); data/wofi-1.2.1/src/main.c:543:4: [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(VERSION"\n"); data/wofi-1.2.1/src/main.c:602:5: [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(config_path, R_OK) == 0) { data/wofi-1.2.1/src/utils.c:54: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(buffer, va_arg(args, char*)); data/wofi-1.2.1/src/utils.c:56:3: [4] (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). strcat(buffer, va_arg(args, char*)); data/wofi-1.2.1/src/utils.c:113:5: [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(path, F_OK) != 0) { data/wofi-1.2.1/src/wofi.c:665:5: [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(cache_path, R_OK) == 0) { data/wofi-1.2.1/src/wofi.c:679:5: [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(num, 5, "%" PRIu64, count); data/wofi-1.2.1/src/wofi.c:707:5: [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(dir, W_OK) == 0) { data/wofi-1.2.1/src/wofi.c:733:5: [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(cache_path, R_OK | W_OK) == 0) { data/wofi-1.2.1/src/wofi.c:775:5: [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(cache_path, R_OK) == 0) { data/wofi-1.2.1/src/wofi.c:861:3: [4] (shell) execlp: 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. execlp(terminal, terminal, "-e", cmd, NULL); data/wofi-1.2.1/src/wofi.c:865:3: [4] (shell) execlp: 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. execlp(terminals[count], terminals[count], "-e", cmd, NULL); data/wofi-1.2.1/modes/drun.c:259:20: [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* data_dirs = getenv("XDG_DATA_DIRS"); data/wofi-1.2.1/modes/drun.c:267:20: [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* data_home = getenv("XDG_DATA_HOME"); data/wofi-1.2.1/modes/drun.c:269:31: [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. data_home = utils_concat(2, getenv("HOME"), "/.local/share"); data/wofi-1.2.1/modes/run.c:90:22: [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* path = strdup(getenv("PATH")); data/wofi-1.2.1/modes/run.c:98:9: [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. str = realpath(str, NULL); data/wofi-1.2.1/src/main.c:466:15: [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((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:GQ:o:", opts, NULL)) != -1) { data/wofi-1.2.1/src/main.c:578:25: [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. const char* home_dir = getenv("HOME"); data/wofi-1.2.1/src/main.c:579:25: [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. const char* xdg_conf = getenv("XDG_CONFIG_HOME"); data/wofi-1.2.1/src/main.c:586:26: [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. const char* xdg_cache = getenv("XDG_CACHE_HOME"); data/wofi-1.2.1/src/wofi.c:431:21: [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* cache_path = getenv("XDG_CACHE_HOME"); data/wofi-1.2.1/src/wofi.c:433:32: [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. cache_path = utils_concat(3, getenv("HOME"), "/.cache/wofi-", mode); data/wofi-1.2.1/src/config.c:66: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* file = fopen(config, "r"); data/wofi-1.2.1/src/main.c:104: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). FILE* file = fopen(stylesheet, "r"); data/wofi-1.2.1/src/main.c:129: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 = fopen(color_path, "r"); data/wofi-1.2.1/src/main.c:155: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 count_str[3]; data/wofi-1.2.1/src/main.c:167: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(replace, color, color_len); data/wofi-1.2.1/src/main.c:184: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 r[3]; data/wofi-1.2.1/src/main.c:185: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 g[3]; data/wofi-1.2.1/src/main.c:186: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 b[3]; data/wofi-1.2.1/src/main.c:187: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(r, color + 1, 2); data/wofi-1.2.1/src/main.c:188: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(g, color + 3, 2); data/wofi-1.2.1/src/main.c:189: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(b, color + 5, 2); data/wofi-1.2.1/src/main.c:193: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 rgb[14]; data/wofi-1.2.1/src/main.c:196: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(replace, rgb, rgb_len); data/wofi-1.2.1/src/wofi.c:376: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 index[11]; data/wofi-1.2.1/src/wofi.c:666: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). FILE* file = fopen(cache_path, "r"); data/wofi-1.2.1/src/wofi.c:678: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 num[6]; data/wofi-1.2.1/src/wofi.c:713: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). FILE* file = fopen(cache_path, "w"); data/wofi-1.2.1/src/wofi.c:737: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). FILE* file = fopen(cache_path, "r"); data/wofi-1.2.1/src/wofi.c:755: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). file = fopen(cache_path, "w"); data/wofi-1.2.1/src/wofi.c:776: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). FILE* file = fopen(cache_path, "r"); data/wofi-1.2.1/modes/run.c:60: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). if(strncmp(node->line, arg_str, strlen(arg_str)) == 0) { data/wofi-1.2.1/modes/run.c:74: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). strncmp(node->line, arg_str, strlen(arg_str)) == 0) && !map_contains(cached, full_path)) { data/wofi-1.2.1/modes/run.c:154: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). size_t cmd_l = strlen(cmd); data/wofi-1.2.1/modes/run.c:182:27: [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(cmd, arg_str, strlen(arg_str)) == 0) { data/wofi-1.2.1/src/config.c:28: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). size_t line_size = strlen(line); data/wofi-1.2.1/src/config.c:56: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(value); data/wofi-1.2.1/src/main.c:158: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). size_t color_len = strlen(color); data/wofi-1.2.1/src/main.c:159: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). size_t needle_len = strlen(needle); data/wofi-1.2.1/src/main.c:181: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). needle_len = strlen(needle); data/wofi-1.2.1/src/main.c:195: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 rgb_len = strlen(rgb); data/wofi-1.2.1/src/main.c:203: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). gtk_css_provider_load_from_data(css, data, strlen(data), NULL); data/wofi-1.2.1/src/utils.c:49: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). buf_s += strlen(va_arg(args, char*)); data/wofi-1.2.1/src/utils.c:81: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). size_t str1_len = strlen(haystack); data/wofi-1.2.1/src/utils.c:82: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). size_t str2_len = strlen(needle); data/wofi-1.2.1/src/wofi.c:613: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(cmd); data/wofi-1.2.1/src/wofi.c:633: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(cmd); data/wofi-1.2.1/src/wofi.c:716:26: [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). fwrite(node->line, 1, strlen(node->line), file); data/wofi-1.2.1/src/wofi.c:758:26: [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). fwrite(node->line, 1, strlen(node->line), file); data/wofi-1.2.1/src/wofi.c:959: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(_filter); data/wofi-1.2.1/src/wofi.c:962: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 t1l = strlen(t1); data/wofi-1.2.1/src/wofi.c:965: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 t2l = strlen(t2); data/wofi-1.2.1/src/wofi.c:1251: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). bool printable = strlen(name) == 1 && isprint(name[0]) && !has_mod(event->key.state); ANALYSIS SUMMARY: Hits = 73 Lines analyzed = 5646 in approximately 0.16 seconds (34784 lines/second) Physical Source Lines of Code (SLOC) = 3985 Hits@level = [0] 66 [1] 22 [2] 20 [3] 11 [4] 20 [5] 0 Hits@level+ = [0+] 139 [1+] 73 [2+] 51 [3+] 31 [4+] 20 [5+] 0 Hits/KSLOC@level+ = [0+] 34.8808 [1+] 18.3187 [2+] 12.798 [3+] 7.77917 [4+] 5.01882 [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.