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-wrapper-1.1.3/src/python/pypamtest.c Examining data/pam-wrapper-1.1.3/src/libpamtest.c Examining data/pam-wrapper-1.1.3/src/modules/pam_set_items.c Examining data/pam-wrapper-1.1.3/src/modules/pam_matrix.c Examining data/pam-wrapper-1.1.3/src/modules/pam_get_items.c Examining data/pam-wrapper-1.1.3/src/modules/pam_chatty.c Examining data/pam-wrapper-1.1.3/src/pam_wrapper.c Examining data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c Examining data/pam-wrapper-1.1.3/include/pwrap_compat.h Examining data/pam-wrapper-1.1.3/include/libpamtest.h FINAL RESULTS: data/pam-wrapper-1.1.3/src/pam_wrapper.c:1293:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ret = readlink(libpam_path, pam_library, sizeof(pam_library) - 1); data/pam-wrapper-1.1.3/src/modules/pam_set_items.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(buffer, sizeof(buffer), format, args); data/pam-wrapper-1.1.3/src/pam_wrapper.c:152: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(buffer, sizeof(buffer), format, args); data/pam-wrapper-1.1.3/src/python/pypamtest.c:86:9: [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). return strcpy(copy, string); data/pam-wrapper-1.1.3/src/python/pypamtest.c:297:4: [4] (format) snprintf: 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. snprintf(test_repr, sizeof(test_repr), REPR_FMT, data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:504:19: [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. pe_ctx->passdb = getenv("PAM_MATRIX_PASSWD"); data/pam-wrapper-1.1.3/src/modules/pam_set_items.c:73:6: [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. d = getenv("PAM_WRAPPER_DEBUGLEVEL"); data/pam-wrapper-1.1.3/src/modules/pam_set_items.c:166:7: [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. v = getenv(envs[i]); data/pam-wrapper-1.1.3/src/pam_wrapper.c:143:6: [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. d = getenv("PAM_WRAPPER_DEBUGLEVEL"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:331:28: [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. const char *env_preload = getenv("LD_PRELOAD"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:332:29: [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. const char *env_deepbind = getenv("UID_WRAPPER_DISABLE_DEEPBIND"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:917:8: [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("PAM_WRAPPER_SERVICE_DIR"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1348:8: [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("PAM_WRAPPER_SERVICE_DIR"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1374:8: [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("PAM_WRAPPER"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1382:9: [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("PAM_WRAPPER_SERVICE_DIR"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1921:6: [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. d = getenv("PAM_WRAPPER_USE_SYSLOG"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:2154:8: [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("PAM_WRAPPER_KEEP_DIR"); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:153:7: [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. db = getenv("PAM_MATRIX_PASSWD"); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:214:6: [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. v = getenv("PAM_WRAPPER_RUNTIME_DIR"); data/pam-wrapper-1.1.3/src/libpamtest.c:194: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(reply->resp, str, len); data/pam-wrapper-1.1.3/src/libpamtest.c:283: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(cctx->data->out_err[cctx->err_idx], data/pam-wrapper-1.1.3/src/libpamtest.c:300: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(cctx->data->out_info[cctx->info_idx], data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:114: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). *num_lines = atoi(*argv+strlen(NUM_LINES_KEY)); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:122: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]; data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:127:7: [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). fp = fopen(db, "r"); data/pam-wrapper-1.1.3/src/modules/pam_matrix.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 buf[BUFSIZ]; data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:196: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 template[PATH_MAX] = { '\0' }; data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:210:7: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). rv = mkstemp(template); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:217:7: [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). fp = fopen(db, "r"); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:218:11: [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). fp_tmp = fopen(template, "w"); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:613: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 cred[PATH_MAX + CRED_VAR_SZ]; data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:681: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 home[PATH_MAX + HOME_VAR_SZ]; data/pam-wrapper-1.1.3/src/modules/pam_set_items.c:68: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[1024]; data/pam-wrapper-1.1.3/src/modules/pam_set_items.c:75:9: [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). lvl = atoi(d); data/pam-wrapper-1.1.3/src/pam_wrapper.c:137: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[1024]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:145:9: [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). lvl = atoi(d); data/pam-wrapper-1.1.3/src/pam_wrapper.c:605: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[BUFFER_SIZE]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:613:10: [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). srcfd = open(src, O_RDONLY, 0); data/pam-wrapper-1.1.3/src/pam_wrapper.c:627:10: [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). dstfd = open(dst, O_CREAT|O_WRONLY|O_TRUNC, mode); data/pam-wrapper-1.1.3/src/pam_wrapper.c:697: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[BUFFER_SIZE]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:748: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 pidfile[len + 5]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:750: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[8] = {0}; data/pam-wrapper-1.1.3/src/pam_wrapper.c:761:7: [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). fd = open(pidfile, O_RDONLY); data/pam-wrapper-1.1.3/src/pam_wrapper.c:818: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 pidfile_path[1024] = { 0 }; data/pam-wrapper-1.1.3/src/pam_wrapper.c:893: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). pidfile = fopen(pidfile_path, "w"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:950: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[PSO_COPY_READ_SIZE + 1]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:961:10: [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). srcfd = open(src, O_RDONLY, 0); data/pam-wrapper-1.1.3/src/pam_wrapper.c:975:10: [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). dstfd = open(dst, O_CREAT|O_WRONLY|O_TRUNC, mode); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1004: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 tmp[16] = {0}; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1008: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, tmp, 12); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1019: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(buf, pdir + 1, 9); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1024:7: [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, pdir + 1, 9); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1070: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[PSO_COPY_READ_SIZE + 1]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1080:10: [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). srcfd = open(src, O_RDONLY, 0); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1094:10: [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). dstfd = open(dst, O_CREAT|O_WRONLY|O_TRUNC, mode); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1123: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, pdir + 1, PSO_COPY_READ_SIZE); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1167: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 pam_library[128] = { 0 }; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1168: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 libpam_path[1024] = { 0 }; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1171: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 pidfile_path[1024] = { 0 }; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1246: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). pidfile = fopen(pidfile_path, "w"); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1309: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 libpam_path_cp[1024] = {0}; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1398: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 fullpath[1024]; data/pam-wrapper-1.1.3/src/pam_wrapper.c:1915: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 syslog_str[32] = {0}; data/pam-wrapper-1.1.3/src/pam_wrapper.c:2053: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 fd_str[64] = { 0 }; data/pam-wrapper-1.1.3/src/python/pypamtest.c:279: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 test_repr[256] = { '\0' }; data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:107: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(reply[i].resp, password, pwlen); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:123: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 passdb_path[PATH_MAX]; data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:135:7: [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). fp = fopen(db, "w"); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:432: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 key_eq[strlen(key) + 1 + 1]; /* trailing = and '\0' */ data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:753: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 auth_info_msg[PAM_MAX_MSG_SIZE] = { '\0' }; data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:783: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 auth_err_msg[PAM_MAX_MSG_SIZE] = { '\0' }; data/pam-wrapper-1.1.3/src/libpamtest.c:187:8: [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 = strlen(str) + 1; data/pam-wrapper-1.1.3/src/libpamtest.c:285:16: [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). MIN(strlen(msgm[i]->msg), data/pam-wrapper-1.1.3/src/libpamtest.c:302:16: [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). MIN(strlen(msgm[i]->msg), data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:112: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). if (strncmp(*argv, NUM_LINES_KEY, strlen(NUM_LINES_KEY)) == 0) { data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:113:16: [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 (*(*argv+strlen(NUM_LINES_KEY)) != '\0') { data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:114: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). *num_lines = atoi(*argv+strlen(NUM_LINES_KEY)); data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:121:8: [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). strlen(ERROR_KEY)) == 0) { data/pam-wrapper-1.1.3/src/modules/pam_chatty.c:124:8: [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). strlen(INFO_KEY)) == 0) { data/pam-wrapper-1.1.3/src/modules/pam_get_items.c:89: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). env_len = strlen(value) + strlen(opt_name) + 2; data/pam-wrapper-1.1.3/src/modules/pam_get_items.c:89: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). env_len = strlen(value) + strlen(opt_name) + 2; data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:209:13: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_mask = umask(S_IRWXO | S_IRWXG); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:211:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_mask); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:474:34: [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 (strncmp(*argv, PASSDB_KEY, strlen(PASSDB_KEY)) == 0) { data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:475:16: [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 (*(*argv+strlen(PASSDB_KEY)) == '\0') { data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:478: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). pe_ctx->passdb = *argv+strlen(PASSDB_KEY); data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:481:8: [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). strlen(VERBOSE_KEY)) == 0) { data/pam-wrapper-1.1.3/src/modules/pam_matrix.c:484:8: [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). strlen(ECHO_KEY)) == 0) { data/pam-wrapper-1.1.3/src/pam_wrapper.c:336: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 (env_preload != NULL && strlen(env_preload) < 1024) { data/pam-wrapper-1.1.3/src/pam_wrapper.c:343:30: [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 (env_deepbind != NULL && strlen(env_deepbind) >= 1) { data/pam-wrapper-1.1.3/src/pam_wrapper.c:634:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bread = read(srcfd, buf, BUFFER_SIZE); data/pam-wrapper-1.1.3/src/pam_wrapper.c:747: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(dir); data/pam-wrapper-1.1.3/src/pam_wrapper.c:775:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, buf, sizeof(buf)); data/pam-wrapper-1.1.3/src/pam_wrapper.c:811: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(tmp_config_dir); data/pam-wrapper-1.1.3/src/pam_wrapper.c:985:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bread = read(srcfd, buf, to_read); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1104:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bread = read(srcfd, buf, to_read); data/pam-wrapper-1.1.3/src/pam_wrapper.c:1162: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(tmp_config_dir); data/pam-wrapper-1.1.3/src/python/pypamtest.c:80: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). copy = PyMem_New(char, strlen(string) + 1); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:98: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). pwlen = strlen(password) + 1; data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:129: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). assert_true(strlen(passdb_path) + sizeof("/passdb") < PATH_MAX); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:130:7: [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. Risk is low because the source is a constant string. db = strncat(passdb_path, "/passdb", strlen("/passdb") + 1); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:130:39: [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). db = strncat(passdb_path, "/passdb", strlen("/passdb") + 1); data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:431: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(key) > 0) { data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:432: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). char key_eq[strlen(key) + 1 + 1]; /* trailing = and '\0' */ data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:623: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). res_len = strlen(s1) + strlen(s2) + 1; data/pam-wrapper-1.1.3/tests/test_pam_wrapper.c:623: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). res_len = strlen(s1) + strlen(s2) + 1; ANALYSIS SUMMARY: Hits = 106 Lines analyzed = 6458 in approximately 0.15 seconds (44290 lines/second) Physical Source Lines of Code (SLOC) = 4905 Hits@level = [0] 28 [1] 35 [2] 52 [3] 14 [4] 4 [5] 1 Hits@level+ = [0+] 134 [1+] 106 [2+] 71 [3+] 19 [4+] 5 [5+] 1 Hits/KSLOC@level+ = [0+] 27.3191 [1+] 21.6106 [2+] 14.475 [3+] 3.8736 [4+] 1.01937 [5+] 0.203874 Dot directories skipped = 2 (--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.