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/qwo-0.5/src/main.c Examining data/qwo-0.5/src/window.c Examining data/qwo-0.5/src/window.h FINAL RESULTS: data/qwo-0.5/src/main.c:93:2: [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. fprintf(stdout, PACKAGE " " VERSION " "); data/qwo-0.5/src/main.c:94:2: [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. fprintf(stdout, copyright_notice); data/qwo-0.5/src/main.c:162: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(*geometry, string); data/qwo-0.5/src/main.c:236:20: [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 ((options = getopt_long(argc, argv, "c:g:f:b:d:hv", long_options, data/qwo-0.5/src/main.c:290: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 *home_dir = getenv("HOME"); data/qwo-0.5/src/main.c:111: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). if ((file = fopen(config_path, "r")) == NULL) { data/qwo-0.5/src/main.c:289: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_path[MAX_CONFIG_PATH]; data/qwo-0.5/src/window.c:78: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 window_name[2]; data/qwo-0.5/src/window.c:107: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(window_name, "%i", number); data/qwo-0.5/src/window.c:154: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 image_path[MAX_IMAGE_PATH]; data/qwo-0.5/src/window.c:403: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 color_spec[13] = "rgb:../../..\0"; data/qwo-0.5/src/main.c:161: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). *geometry = (char *) malloc(sizeof(char) * strlen(string)); data/qwo-0.5/src/main.c:291:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(config_path, home_dir, MAX_CONFIG_PATH); data/qwo-0.5/src/main.c:292:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(config_path + strlen(home_dir), CONFIG_FILE, data/qwo-0.5/src/main.c:292: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). strncat(config_path + strlen(home_dir), CONFIG_FILE, data/qwo-0.5/src/main.c:293: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). MAX_CONFIG_PATH - strlen(home_dir)); data/qwo-0.5/src/window.c:178:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(image_path, DATA_PATH, MAX_IMAGE_PATH); data/qwo-0.5/src/window.c:179:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(image_path + strlen(DATA_PATH), image_names[num], data/qwo-0.5/src/window.c:179: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). strncat(image_path + strlen(DATA_PATH), image_names[num], data/qwo-0.5/src/window.c:180: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). MAX_IMAGE_PATH - strlen(DATA_PATH)); data/qwo-0.5/src/window.c:181:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(image_path + strlen(DATA_PATH) + strlen(image_names[num]), data/qwo-0.5/src/window.c:181: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). strncat(image_path + strlen(DATA_PATH) + strlen(image_names[num]), data/qwo-0.5/src/window.c:181:43: [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). strncat(image_path + strlen(DATA_PATH) + strlen(image_names[num]), data/qwo-0.5/src/window.c:182:36: [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). IMAGE_SUFFIXE, MAX_IMAGE_PATH - strlen(DATA_PATH) - strlen(image_names[num])); data/qwo-0.5/src/window.c:182:56: [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). IMAGE_SUFFIXE, MAX_IMAGE_PATH - strlen(DATA_PATH) - strlen(image_names[num])); data/qwo-0.5/src/window.c:408:45: [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 (color[0] == '0' && color[1] == 'x' && (strlen(color) == 8)) { ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 1093 in approximately 0.05 seconds (19925 lines/second) Physical Source Lines of Code (SLOC) = 831 Hits@level = [0] 10 [1] 15 [2] 6 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 36 [1+] 26 [2+] 11 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 43.3213 [1+] 31.2876 [2+] 13.2371 [3+] 6.01685 [4+] 3.61011 [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.