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/suckless-tools-46/dmenu/arg.h Examining data/suckless-tools-46/dmenu/config.def.h Examining data/suckless-tools-46/dmenu/drw.h Examining data/suckless-tools-46/dmenu/util.h Examining data/suckless-tools-46/dmenu/drw.c Examining data/suckless-tools-46/dmenu/dmenu.c Examining data/suckless-tools-46/dmenu/util.c Examining data/suckless-tools-46/dmenu/stest.c Examining data/suckless-tools-46/lsw/lsw.c Examining data/suckless-tools-46/slock/config.def.h Examining data/suckless-tools-46/slock/util.h Examining data/suckless-tools-46/slock/arg.h Examining data/suckless-tools-46/slock/explicit_bzero.c Examining data/suckless-tools-46/slock/slock.c Examining data/suckless-tools-46/sprop/sprop.c Examining data/suckless-tools-46/sselp/sselp.c Examining data/suckless-tools-46/ssid/ssid.c Examining data/suckless-tools-46/swarp/swarp.c Examining data/suckless-tools-46/tabbed/arg.h Examining data/suckless-tools-46/tabbed/tabbed.c Examining data/suckless-tools-46/tabbed/config.def.h Examining data/suckless-tools-46/wmname/wmname.c Examining data/suckless-tools-46/xssstate/arg.h Examining data/suckless-tools-46/xssstate/xssstate.c FINAL RESULTS: data/suckless-tools-46/dmenu/dmenu.c:224: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(buf, text); data/suckless-tools-46/dmenu/stest.c:40:20: [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. && (!FLAG('e') || access(path, F_OK) == 0) /* exists */ data/suckless-tools-46/dmenu/stest.c:47:20: [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. && (!FLAG('r') || access(path, R_OK) == 0) /* readable */ data/suckless-tools-46/dmenu/stest.c:50:20: [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. && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ data/suckless-tools-46/dmenu/stest.c:51:20: [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. && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ data/suckless-tools-46/dmenu/util.c:24:2: [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/suckless-tools-46/slock/slock.c:67:2: [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, errstr, ap); data/suckless-tools-46/slock/slock.c:181:23: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. if (!(inputhash = crypt(passwd, hash))) data/suckless-tools-46/slock/slock.c:349:7: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. if (!crypt("", hash)) data/suckless-tools-46/slock/slock.c:384:4: [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(argv[0], argv); data/suckless-tools-46/ssid/ssid.c:34:2: [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(argv[1], argv + 1); data/suckless-tools-46/tabbed/tabbed.c:301:2: [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, errstr, ap); data/suckless-tools-46/tabbed/tabbed.c:1028:4: [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(((char **)arg->v)[0], (char **)arg->v); data/suckless-tools-46/tabbed/tabbed.c:1033:4: [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(cmd[0], cmd); data/suckless-tools-46/wmname/wmname.c:15:2: [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, errstr, ap); data/suckless-tools-46/xssstate/xssstate.c:22:2: [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, errstr, ap); data/suckless-tools-46/dmenu/config.def.h:10:14: [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. static const char *colors[SchemeLast][2] = { data/suckless-tools-46/dmenu/dmenu.c:37:8: [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. static char text[BUFSIZ] = ""; data/suckless-tools-46/dmenu/dmenu.c:219: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 buf[sizeof text], *s; data/suckless-tools-46/dmenu/dmenu.c:275:3: [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(&text[cursor], str, n); data/suckless-tools-46/dmenu/dmenu.c:310: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 buf[32]; data/suckless-tools-46/dmenu/dmenu.c:524: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 buf[sizeof text], *p; data/suckless-tools-46/dmenu/dmenu.c:719:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). lines = atoi(argv[++i]); data/suckless-tools-46/dmenu/dmenu.c:721:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). mon = atoi(argv[++i]); data/suckless-tools-46/dmenu/drw.c:14:23: [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. static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; data/suckless-tools-46/dmenu/drw.c:15:23: [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. static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; data/suckless-tools-46/dmenu/drw.c:254: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 buf[1024]; data/suckless-tools-46/dmenu/drw.c:317: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, utf8str, len); data/suckless-tools-46/dmenu/stest.c:71: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], *line = NULL, *file; data/suckless-tools-46/lsw/lsw.c:50: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. static char buf[BUFSIZ]; data/suckless-tools-46/slock/config.def.h:5:14: [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. static const char *colorname[NUMCOLS] = { data/suckless-tools-46/slock/slock.c:82: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 (!(f = fopen(oomfile, "w"))) { data/suckless-tools-46/slock/slock.c:147: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 buf[32], passwd[256], *inputhash; data/suckless-tools-46/slock/slock.c:204: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(passwd + len, buf, num); data/suckless-tools-46/sprop/sprop.c:30:9: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). win = atol(argv[1]); data/suckless-tools-46/sselp/sselp.c:37: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(result, data, *len); data/suckless-tools-46/tabbed/tabbed.c:81: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 name[256]; data/suckless-tools-46/tabbed/tabbed.c:98:28: [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. static void drawtext(const char *text, unsigned long col[ColLast]); data/suckless-tools-46/tabbed/tabbed.c:162:8: [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. static char winid[64]; data/suckless-tools-46/tabbed/tabbed.c:365:16: [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. drawtext(const char *text, unsigned long col[ColLast]) { data/suckless-tools-46/tabbed/tabbed.c:367: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 buf[256]; data/suckless-tools-46/tabbed/tabbed.c:386: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(buf, text, len); data/suckless-tools-46/tabbed/tabbed.c:428: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 buf[BUFSIZ] = "tabbed-"VERSION" ::"; data/suckless-tools-46/tabbed/tabbed.c:497: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. static char buf[BUFSIZ]; data/suckless-tools-46/tabbed/tabbed.c:1232:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). newposition = atoi(&pstr[1]); data/suckless-tools-46/tabbed/tabbed.c:1234:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). newposition = atoi(pstr); data/suckless-tools-46/tabbed/tabbed.c:1238:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). replace = atoi(EARGF(usage())); data/suckless-tools-46/wmname/wmname.c:48:84: [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. XChangeProperty(dpy, root, netwmname, utf8_string, 8, PropModeReplace, (unsigned char *)argv[1], strlen(argv[1])); data/suckless-tools-46/dmenu/dmenu.c:110: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). for (len = strlen(sub); *s; s++) data/suckless-tools-46/dmenu/dmenu.c:229: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). len = tokc ? strlen(tokv[0]) : 0; data/suckless-tools-46/dmenu/dmenu.c:232: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). textsize = strlen(text) + 1; data/suckless-tools-46/dmenu/dmenu.c:270: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(text) + n > sizeof text - 1) data/suckless-tools-46/dmenu/dmenu.c:414: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). cursor = strlen(text); data/suckless-tools-46/dmenu/dmenu.c:492:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text, sel->text, sizeof text - 1); data/suckless-tools-46/dmenu/dmenu.c:494: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). cursor = strlen(text); data/suckless-tools-46/dmenu/dmenu.c:515:54: [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). insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); data/suckless-tools-46/dmenu/dmenu.c:536: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). die("cannot strdup %u bytes:", strlen(buf) + 1); data/suckless-tools-46/dmenu/dmenu.c:538: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). drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL); data/suckless-tools-46/dmenu/util.c:27: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). if (fmt[0] && fmt[strlen(fmt)-1] == ':') { data/suckless-tools-46/lsw/lsw.c:59:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, list[0], sizeof buf); data/suckless-tools-46/lsw/lsw.c:62:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, (char *)prop.value, sizeof buf); data/suckless-tools-46/slock/slock.c:304:3: [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(100000); data/suckless-tools-46/sprop/sprop.c:71: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). (unsigned char *)value, strlen(value)); data/suckless-tools-46/tabbed/tabbed.c:47: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). #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) data/suckless-tools-46/tabbed/tabbed.c:375: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). olen = strlen(text); data/suckless-tools-46/tabbed/tabbed.c:434: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). for(i = 0, n = strlen(buf); cmd[i] && n < sizeof(buf); i++) data/suckless-tools-46/tabbed/tabbed.c:506:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, (char *)p, LENGTH(buf)-1); data/suckless-tools-46/tabbed/tabbed.c:572:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text, (char *)name.value, size - 1); data/suckless-tools-46/tabbed/tabbed.c:576:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text, *list, size - 1); data/suckless-tools-46/wmname/wmname.c:48:100: [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). XChangeProperty(dpy, root, netwmname, utf8_string, 8, PropModeReplace, (unsigned char *)argv[1], strlen(argv[1])); ANALYSIS SUMMARY: Hits = 70 Lines analyzed = 3960 in approximately 0.12 seconds (34003 lines/second) Physical Source Lines of Code (SLOC) = 3286 Hits@level = [0] 36 [1] 22 [2] 32 [3] 0 [4] 16 [5] 0 Hits@level+ = [0+] 106 [1+] 70 [2+] 48 [3+] 16 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 32.2581 [1+] 21.3025 [2+] 14.6074 [3+] 4.86914 [4+] 4.86914 [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.