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-tmpdir-0.09/util.c Examining data/pam-tmpdir-0.09/util.h Examining data/pam-tmpdir-0.09/pam_tmpdir.c Examining data/pam-tmpdir-0.09/pam-tmpdir-helper.c FINAL RESULTS: data/pam-tmpdir-0.09/pam-tmpdir-helper.c:53:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(tmpdir, 0, 0) == -1) { data/pam-tmpdir-0.09/pam-tmpdir-helper.c:99:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(user_tmpdir, getuid(), getgid()) == -1) { data/pam-tmpdir-0.09/pam-tmpdir-helper.c:123:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(user_tmpdir, 0700) == -1) { data/pam-tmpdir-0.09/pam_tmpdir.c:115:5: [4] (shell) execl: 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. execl(PAM_TMPDIR_HELPER,PAM_TMPDIR_HELPER,NULL); data/pam-tmpdir-0.09/util.c:43: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(ret, buf); data/pam-tmpdir-0.09/util.c:34: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 buf[512]; data/pam-tmpdir-0.09/util.c:115:10: [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). conf = fopen(CONFIG_FILE,"r"); data/pam-tmpdir-0.09/pam-tmpdir-helper.c:43:15: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(0000); data/pam-tmpdir-0.09/pam-tmpdir-helper.c:59:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/pam-tmpdir-0.09/util.c:134: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). if (value[strlen(value)-1] == '\n') { data/pam-tmpdir-0.09/util.c:135: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). value[strlen(value)-1] = '\0'; ANALYSIS SUMMARY: Hits = 11 Lines analyzed = 559 in approximately 0.02 seconds (25466 lines/second) Physical Source Lines of Code (SLOC) = 411 Hits@level = [0] 0 [1] 4 [2] 2 [3] 0 [4] 2 [5] 3 Hits@level+ = [0+] 11 [1+] 11 [2+] 7 [3+] 5 [4+] 5 [5+] 3 Hits/KSLOC@level+ = [0+] 26.764 [1+] 26.764 [2+] 17.0316 [3+] 12.1655 [4+] 12.1655 [5+] 7.29927 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.