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/kwallet-pam-5.19.5/pam_darwin.h Examining data/kwallet-pam-5.19.5/pam_kwallet.c Examining data/kwallet-pam-5.19.5/pam_darwin.c FINAL RESULTS: data/kwallet-pam-5.19.5/pam_kwallet.c:393:5: [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(local.sun_path, fullSocket); data/kwallet-pam-5.19.5/pam_kwallet.c:793:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath); data/kwallet-pam-5.19.5/pam_kwallet.c:125:11: [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. env = getenv (name); data/kwallet-pam-5.19.5/pam_kwallet.c:425:5: [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 pipeInt[4]; data/kwallet-pam-5.19.5/pam_kwallet.c:426:5: [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(pipeInt, "%d", toWalletPipe[0]); data/kwallet-pam-5.19.5/pam_kwallet.c:427:5: [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 sockIn[4]; data/kwallet-pam-5.19.5/pam_kwallet.c:428:5: [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(sockIn, "%d", envSocket); data/kwallet-pam-5.19.5/pam_kwallet.c:669:24: [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). const int fd = open(path, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0600); data/kwallet-pam-5.19.5/pam_kwallet.c:728:24: [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). const int fd = open(path, O_RDONLY | O_CLOEXEC); data/kwallet-pam-5.19.5/pam_kwallet.c:736: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. char salt[KWALLET_PAM_SALTSIZE] = {}; data/kwallet-pam-5.19.5/pam_kwallet.c:797:5: [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 salt[KWALLET_PAM_SALTSIZE] = {}; data/kwallet-pam-5.19.5/pam_kwallet.c:140: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). size_t pamEnvSize = strlen(name) + strlen(value) + 2; //2 is for = and \0 data/kwallet-pam-5.19.5/pam_kwallet.c:140:40: [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 pamEnvSize = strlen(name) + strlen(value) + 2; //2 is for = and \0 data/kwallet-pam-5.19.5/pam_kwallet.c:163: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). const size_t len = strlen (str); data/kwallet-pam-5.19.5/pam_kwallet.c:250: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). return (pam_xdisplay && strlen(pam_xdisplay) != 0) data/kwallet-pam-5.19.5/pam_kwallet.c:387: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). if (strlen(fullSocket) > sizeof(local.sun_path)) { data/kwallet-pam-5.19.5/pam_kwallet.c:400: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). size_t len = strlen(local.sun_path) + sizeof(local.sun_family); data/kwallet-pam-5.19.5/pam_kwallet.c:664: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). dir[strlen(dir) - 14] = '\0';//remove kdewallet.salt data/kwallet-pam-5.19.5/pam_kwallet.c:737:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t bytesRead = read(fd, salt, KWALLET_PAM_SALTSIZE); data/kwallet-pam-5.19.5/pam_kwallet.c:762:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t readBytes = read(readSaltPipe[0], saltOut, KWALLET_PAM_SALTSIZE); data/kwallet-pam-5.19.5/pam_kwallet.c:791:23: [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 pathSize = strlen(userInfo->pw_dir) + strlen(kdehome) + strlen(fixpath) + 3;//3 == /, / and \0 data/kwallet-pam-5.19.5/pam_kwallet.c:791:50: [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 pathSize = strlen(userInfo->pw_dir) + strlen(kdehome) + strlen(fixpath) + 3;//3 == /, / and \0 data/kwallet-pam-5.19.5/pam_kwallet.c:791:68: [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 pathSize = strlen(userInfo->pw_dir) + strlen(kdehome) + strlen(fixpath) + 3;//3 == /, / and \0 data/kwallet-pam-5.19.5/pam_kwallet.c:822:41: [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). error = gcry_kdf_derive(passphrase, strlen(passphrase), ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 910 in approximately 0.05 seconds (19019 lines/second) Physical Source Lines of Code (SLOC) = 650 Hits@level = [0] 29 [1] 13 [2] 8 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 53 [1+] 24 [2+] 11 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 81.5385 [1+] 36.9231 [2+] 16.9231 [3+] 4.61538 [4+] 3.07692 [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.