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/cwm-6.6/calmwm.c Examining data/cwm-6.6/calmwm.h Examining data/cwm-6.6/client.c Examining data/cwm-6.6/group.c Examining data/cwm-6.6/kbfunc.c Examining data/cwm-6.6/menu.c Examining data/cwm-6.6/queue.h Examining data/cwm-6.6/reallocarray.c Examining data/cwm-6.6/screen.c Examining data/cwm-6.6/search.c Examining data/cwm-6.6/strlcat.c Examining data/cwm-6.6/strlcpy.c Examining data/cwm-6.6/strtonum.c Examining data/cwm-6.6/util.c Examining data/cwm-6.6/xevents.c Examining data/cwm-6.6/xmalloc.c Examining data/cwm-6.6/xutil.c Examining data/cwm-6.6/conf.c FINAL RESULTS: data/cwm-6.6/calmwm.h:507:35: [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. __attribute__((__format__ (printf, 2, 3))) data/cwm-6.6/calmwm.h:552:35: [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. __attribute__((__format__ (printf, 3, 4))); data/cwm-6.6/calmwm.h:612:35: [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. __attribute__((__format__ (printf, 3, 4))) data/cwm-6.6/calmwm.h:620:35: [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. __attribute__((__format__ (printf, 2, 3))) data/cwm-6.6/kbfunc.c:632: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(tpath, X_OK) == 0) data/cwm-6.6/menu.c:603:9: [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. (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap); data/cwm-6.6/search.c:173:29: [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 ((flag & PATH_EXEC) && access(g.gl_pathv[i], X_OK)) data/cwm-6.6/search.c:271:8: [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. (void)snprintf(mi->print, sizeof(mi->print), data/cwm-6.6/util.c:83:8: [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. (void)execvp(args[0], args); data/cwm-6.6/util.c:117:3: [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(stderr, msg, ap); data/cwm-6.6/util.c:120:3: [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(stderr, fmt, ap); data/cwm-6.6/calmwm.c:69: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 ((ch = getopt(argc, argv, "c:d:nv")) != -1) { data/cwm-6.6/conf.c:310:9: [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. home = getenv("HOME"); data/cwm-6.6/kbfunc.c:603:14: [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 ((path = getenv("PATH")) == NULL) data/cwm-6.6/calmwm.c:192: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 msg[80], number[80], req[80]; data/cwm-6.6/calmwm.h:299: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 text[MENU_MAXENTRY + 1]; data/cwm-6.6/calmwm.h:300: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 print[MENU_MAXENTRY + 1]; data/cwm-6.6/calmwm.h:321: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[CWM_COLOR_NITEMS]; data/cwm-6.6/kbfunc.c:591: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 **ap, *paths[NPATHS], *path, *pathcpy; data/cwm-6.6/kbfunc.c:592: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 tpath[PATH_MAX]; data/cwm-6.6/kbfunc.c:660: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 hostbuf[_POSIX_HOST_NAME_MAX+1]; data/cwm-6.6/kbfunc.c:661: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 path[PATH_MAX]; data/cwm-6.6/kbfunc.c:673: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). if ((fp = fopen(Conf.known_hosts, "r")) == NULL) { data/cwm-6.6/menu.c:55: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 searchstr[MENU_MAXENTRY + 1]; data/cwm-6.6/menu.c:56: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 dispstr[MENU_MAXENTRY*2 + 1]; data/cwm-6.6/menu.c:57: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 promptstr[MENU_MAXENTRY + 1]; data/cwm-6.6/menu.c:225: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 chr[32]; data/cwm-6.6/util.c:55: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 *args[MAXARGLEN], **ap = args; data/cwm-6.6/xutil.c:337:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(state, p, *n * sizeof(Atom)); data/cwm-6.6/conf.c:463:39: [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 (strncasecmp(wn->name, cc->name, strlen(wn->name)) == 0) { data/cwm-6.6/kbfunc.c:686:33: [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(buf, HASH_MARKER, strlen(HASH_MARKER)) == 0) data/cwm-6.6/menu.c:235:14: [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 ((len = strlen(mc->searchstr)) > 0) { data/cwm-6.6/menu.c:286: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). strlen(mi->text))) == 0) data/cwm-6.6/menu.c:356: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). (const FcChar8*)mc->dispstr, strlen(mc->dispstr), &extents); data/cwm-6.6/menu.c:365:11: [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). MIN(strlen(mi->print), MENU_MAXENTRY), &extents); data/cwm-6.6/menu.c:403: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). (const FcChar8*)mc->dispstr, strlen(mc->dispstr)); data/cwm-6.6/menu.c:415: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). (const FcChar8*)mi->print, strlen(mi->print)); data/cwm-6.6/menu.c:444:33: [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). (const FcChar8*)mi->print, strlen(mi->print)); data/cwm-6.6/screen.c:289: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). strlen(text), &extents); data/cwm-6.6/screen.c:294: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). (const FcChar8*)text, strlen(text)); data/cwm-6.6/search.c:51:8: [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). len = strlen(str); data/cwm-6.6/search.c:52:11: [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). sublen = strlen(sub); data/cwm-6.6/strlcat.c:49: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). return(dlen + strlen(src)); data/cwm-6.6/util.c:98:10: [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). siz += strlen(argv[i]) + 1; data/cwm-6.6/xutil.c:119: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). (unsigned char *)Conf.wmname, strlen(Conf.wmname)); data/cwm-6.6/xutil.c:288:10: [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). p += strlen(p) + 1; data/cwm-6.6/xutil.c:298:10: [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). len += strlen(gc->name) + 1; data/cwm-6.6/xutil.c:303:10: [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). slen = strlen(gc->name) + 1; ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 7169 in approximately 0.23 seconds (31213 lines/second) Physical Source Lines of Code (SLOC) = 5647 Hits@level = [0] 11 [1] 19 [2] 15 [3] 3 [4] 11 [5] 0 Hits@level+ = [0+] 59 [1+] 48 [2+] 29 [3+] 14 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 10.448 [1+] 8.50009 [2+] 5.13547 [3+] 2.47919 [4+] 1.94794 [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.