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/passwdqc-1.4.0/wordset_4k.h Examining data/passwdqc-1.4.0/passwdqc.h Examining data/passwdqc-1.4.0/pam_macros.h Examining data/passwdqc-1.4.0/pwqgen.c Examining data/passwdqc-1.4.0/concat.h Examining data/passwdqc-1.4.0/pwqcheck.c Examining data/passwdqc-1.4.0/passwdqc_i18n.h Examining data/passwdqc-1.4.0/passwdqc_memzero.c Examining data/passwdqc-1.4.0/passwdqc_parse.c Examining data/passwdqc-1.4.0/concat.c Examining data/passwdqc-1.4.0/passwdqc_check.c Examining data/passwdqc-1.4.0/wordset_4k.c Examining data/passwdqc-1.4.0/passwdqc_load.c Examining data/passwdqc-1.4.0/pam_passwdqc.c Examining data/passwdqc-1.4.0/passwdqc_random.c FINAL RESULTS: data/passwdqc-1.4.0/pam_passwdqc.c:190:25: [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/passwdqc-1.4.0/pam_passwdqc.c:201:11: [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. needed = vsnprintf(buffer, sizeof(buffer), format, args); data/passwdqc-1.4.0/pam_passwdqc.c:249:11: [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. hash = crypt(pass, spw->sp_pwdp); data/passwdqc-1.4.0/pam_passwdqc.c:260:10: [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. hash = crypt(pass, pw->pw_passwd); data/passwdqc-1.4.0/concat.c:42: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(p = result, s1, n); data/passwdqc-1.4.0/concat.c:49: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(p, s, l); data/passwdqc-1.4.0/pam_passwdqc.c:195: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 buffer[0x800]; data/passwdqc-1.4.0/passwdqc_check.c:290: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(scratch, original, pos); data/passwdqc-1.4.0/passwdqc_check.c:291: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(&scratch[pos], data/passwdqc-1.4.0/passwdqc_check.c:394: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 word[WORDSET_4K_LENGTH_MAX + 1]; data/passwdqc-1.4.0/passwdqc_check.c:406: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(word, _passwdqc_wordset_4k[i], WORDSET_4K_LENGTH_MAX); data/passwdqc-1.4.0/passwdqc_check.c:432: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(word, "%u", i); data/passwdqc-1.4.0/passwdqc_check.c:443: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 truncated[9]; data/passwdqc-1.4.0/passwdqc_load.c:19: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(unsigned int) * 3 + 1]; data/passwdqc-1.4.0/passwdqc_load.c:24: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(buf, "%u", lineno); data/passwdqc-1.4.0/passwdqc_load.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 buf[8192]; data/passwdqc-1.4.0/passwdqc_load.c:115:13: [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(pathname, "r"))) { data/passwdqc-1.4.0/passwdqc_random.c:85: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 output[0x100], *retval; data/passwdqc-1.4.0/passwdqc_random.c:92:11: [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. unsigned char bytes[3]; data/passwdqc-1.4.0/passwdqc_random.c:147:12: [2] (misc) open: 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 ((fd = open("/dev/urandom", O_RDONLY)) < 0) data/passwdqc-1.4.0/passwdqc_random.c:170: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(&output[length], start, extra); data/passwdqc-1.4.0/pwqcheck.c:78: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(pw, p, sizeof(*pw)); data/passwdqc-1.4.0/wordset_4k.c:60:7: [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. const char _passwdqc_wordset_4k[0x1000][WORDSET_4K_LENGTH_MAX] = { data/passwdqc-1.4.0/wordset_4k.h:11: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. extern const char _passwdqc_wordset_4k[0x1000][WORDSET_4K_LENGTH_MAX]; data/passwdqc-1.4.0/concat.c:27: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). m = n = strlen(s1); data/passwdqc-1.4.0/concat.c:30: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). l = strlen(s); data/passwdqc-1.4.0/concat.c:46: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). l = strlen(s); data/passwdqc-1.4.0/pam_macros.h:18: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). memset((x), 0, strlen(x)); \ data/passwdqc-1.4.0/pam_passwdqc.c:218: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(newpass) > (size_t)qc->max) { data/passwdqc-1.4.0/pam_passwdqc.c:245: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(spw->sp_pwdp) >= 13) { data/passwdqc-1.4.0/pam_passwdqc.c:253: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). _passwdqc_memzero(spw->sp_pwdp, strlen(spw->sp_pwdp)); data/passwdqc-1.4.0/pam_passwdqc.c:259: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(pw->pw_passwd) >= 13) data/passwdqc-1.4.0/pam_passwdqc.c:262: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). _passwdqc_memzero(pw->pw_passwd, strlen(pw->pw_passwd)); data/passwdqc-1.4.0/pam_passwdqc.c:364: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). _passwdqc_memzero(pw->pw_passwd, strlen(pw->pw_passwd)); data/passwdqc-1.4.0/passwdqc_check.c:188: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). if (!dst && !(dst = malloc(strlen(src) + 1))) data/passwdqc-1.4.0/passwdqc_check.c:228: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). if (!(dst = malloc(strlen(src) + 1))) data/passwdqc-1.4.0/passwdqc_check.c:231: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). sptr = &src[strlen(src)]; data/passwdqc-1.4.0/passwdqc_check.c:244: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). _passwdqc_memzero(dst, strlen(dst)); data/passwdqc-1.4.0/passwdqc_check.c:273: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). length = strlen(needle); data/passwdqc-1.4.0/passwdqc_check.c:407: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). length = strlen(word); data/passwdqc-1.4.0/passwdqc_check.c:456: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). length = strlen(newpass); data/passwdqc-1.4.0/passwdqc_check.c:471:4: [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(truncated, newpass, 8); data/passwdqc-1.4.0/passwdqc_load.c:62: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(buf) >= sizeof(buf) - 1) { data/passwdqc-1.4.0/passwdqc_parse.c:17: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(prefix); data/passwdqc-1.4.0/passwdqc_random.c:66:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). block = read(fd, &buffer[offset], count); data/passwdqc-1.4.0/pwqcheck.c:38: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(buf) >= size) { data/passwdqc-1.4.0/pwqcheck.c:77: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). _passwdqc_memzero(p->pw_passwd, strlen(p->pw_passwd)); data/passwdqc-1.4.0/pwqgen.c:69: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). _passwdqc_memzero(pass, strlen(pass)); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 6300 in approximately 0.14 seconds (44914 lines/second) Physical Source Lines of Code (SLOC) = 5735 Hits@level = [0] 13 [1] 24 [2] 20 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 61 [1+] 48 [2+] 24 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 10.6364 [1+] 8.36966 [2+] 4.18483 [3+] 0.697472 [4+] 0.697472 [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.