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/pam-p11-0.3.1/src/base64.c Examining data/pam-p11-0.3.1/src/login.c Examining data/pam-p11-0.3.1/src/match_opensc.c Examining data/pam-p11-0.3.1/src/match_openssh.c Examining data/pam-p11-0.3.1/src/pam_p11.c Examining data/pam-p11-0.3.1/src/passwd.c Examining data/pam-p11-0.3.1/src/test.c FINAL RESULTS: data/pam-p11-0.3.1/src/pam_p11.c:68:43: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #define pam_syslog(handle, level, msg...) syslog(level, ## msg) data/pam-p11-0.3.1/src/pam_p11.c:82:2: [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. vsnprintf(text, sizeof text, fmt, args); data/pam-p11-0.3.1/src/test.c:60: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(module, LIBDIR "/opensc-pkcs11.so"); data/pam-p11-0.3.1/src/base64.c:25: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 bin_table[128] = { data/pam-p11-0.3.1/src/match_opensc.c:16: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 filename[PATH_MAX]; data/pam-p11-0.3.1/src/match_openssh.c:160: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 decoded[OPENSSH_LINE_MAX]; data/pam-p11-0.3.1/src/match_openssh.c:252: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 decoded[OPENSSH_LINE_MAX]; data/pam-p11-0.3.1/src/match_openssh.c:360: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 filename[PATH_MAX]; data/pam-p11-0.3.1/src/match_openssh.c:361: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 line[OPENSSH_LINE_MAX]; data/pam-p11-0.3.1/src/match_openssh.c:372:9: [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(filename, "r"); data/pam-p11-0.3.1/src/pam_p11.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 text[128]; data/pam-p11-0.3.1/src/pam_p11.c:363: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 regex_error[256]; data/pam-p11-0.3.1/src/pam_p11.c:621:11: [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). int fd = open("/dev/urandom", O_RDONLY); data/pam-p11-0.3.1/src/pam_p11.c:637: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 challenge[30]; data/pam-p11-0.3.1/src/test.c:42: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 user[32]; data/pam-p11-0.3.1/src/test.c:43: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 module[4096]; data/pam-p11-0.3.1/src/pam_p11.c:353:51: [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 (NULL != password && NULL != pin_regex && 0 < strlen(pin_regex)) { data/pam-p11-0.3.1/src/pam_p11.c:393: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). OPENSSL_cleanse(password, strlen(password)); data/pam-p11-0.3.1/src/pam_p11.c:493: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). OPENSSL_cleanse(retyped, strlen(retyped)); data/pam-p11-0.3.1/src/pam_p11.c:497: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). OPENSSL_cleanse(new, strlen(new)); data/pam-p11-0.3.1/src/pam_p11.c:501: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). OPENSSL_cleanse(old, strlen(old)); data/pam-p11-0.3.1/src/pam_p11.c:622:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (0 <= fd && read(fd, r, r_len) == (ssize_t)r_len) { data/pam-p11-0.3.1/src/test.c:66:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(user, argv[2], (sizeof user) - 1); data/pam-p11-0.3.1/src/test.c:69:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(module, argv[1], (sizeof module) - 1); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 1581 in approximately 0.06 seconds (25202 lines/second) Physical Source Lines of Code (SLOC) = 1168 Hits@level = [0] 7 [1] 8 [2] 13 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 31 [1+] 24 [2+] 16 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 26.5411 [1+] 20.5479 [2+] 13.6986 [3+] 2.56849 [4+] 2.56849 [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.