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/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c Examining data/ecryptfs-utils-111/src/libecryptfs/messaging.c Examining data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c Examining data/ecryptfs-utils-111/src/libecryptfs/module_mgr.c Examining data/ecryptfs-utils-111/src/libecryptfs/key_management.c Examining data/ecryptfs-utils-111/src/libecryptfs/packets.c Examining data/ecryptfs-utils-111/src/libecryptfs/key_mod.c Examining data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c Examining data/ecryptfs-utils-111/src/libecryptfs/sysfs.c Examining data/ecryptfs-utils-111/src/libecryptfs/miscdev.c Examining data/ecryptfs-utils-111/src/libecryptfs/main.c Examining data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_gpg.c Examining data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c Examining data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c Examining data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_passphrase.c Examining data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c Examining data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c Examining data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c Examining data/ecryptfs-utils-111/src/include/decision_graph.h Examining data/ecryptfs-utils-111/src/include/ecryptfs.h Examining data/ecryptfs-utils-111/src/utils/test.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs-stat.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c Examining data/ecryptfs-utils-111/src/utils/manager.c Examining data/ecryptfs-utils-111/src/utils/io.c Examining data/ecryptfs-utils-111/src/utils/umount.ecryptfs.c Examining data/ecryptfs-utils-111/src/utils/gen_key.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.c Examining data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c Examining data/ecryptfs-utils-111/src/utils/io.h Examining data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c Examining data/ecryptfs-utils-111/src/utils/plaintext_decision_graph.c Examining data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c Examining data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c Examining data/ecryptfs-utils-111/src/daemon/main.c Examining data/ecryptfs-utils-111/tests/kernel/lp-870326/test.c Examining data/ecryptfs-utils-111/tests/kernel/miscdev-bad-count/test.c Examining data/ecryptfs-utils-111/tests/kernel/file-concurrent/test.c Examining data/ecryptfs-utils-111/tests/kernel/read-dir/test.c Examining data/ecryptfs-utils-111/tests/kernel/lp-509180/test.c Examining data/ecryptfs-utils-111/tests/kernel/llseek/test.c Examining data/ecryptfs-utils-111/tests/kernel/mmap-bmap/test.c Examining data/ecryptfs-utils-111/tests/kernel/mmap-dir/test.c Examining data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c Examining data/ecryptfs-utils-111/tests/kernel/enospc/test.c Examining data/ecryptfs-utils-111/tests/kernel/mmap-close/test.c Examining data/ecryptfs-utils-111/tests/kernel/xattr/test.c Examining data/ecryptfs-utils-111/tests/kernel/lp-524919/test.c Examining data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c Examining data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c Examining data/ecryptfs-utils-111/tests/kernel/inotify/test.c Examining data/ecryptfs-utils-111/tests/kernel/lp-994247/test.c Examining data/ecryptfs-utils-111/tests/kernel/directory-concurrent/test.c Examining data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c Examining data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c Examining data/ecryptfs-utils-111/tests/userspace/lfs/test.c Examining data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c Examining data/ecryptfs-utils-111/tests/lib/etl_add_passphrase_key_to_keyring.c FINAL RESULTS: data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:250:6: [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(dot_ecryptfs_dir, getuid(), getgid()) == -1) data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:352:13: [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. useMtab = (readlink("/etc/mtab", &dummy, 1) < 0); data/ecryptfs-utils-111/tests/kernel/inotify/test.c:246:6: [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(path, S_IRUSR | S_IWUSR) < 0) { data/ecryptfs-utils-111/tests/kernel/lp-524919/test.c:76:6: [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. n = readlink(link, buf, sizeof(buf)); data/ecryptfs-utils-111/src/daemon/main.c:88:3: [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 ( data/ecryptfs-utils-111/src/daemon/main.c:301:4: [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. printf(("%s (%s) %s\n" data/ecryptfs-utils-111/src/include/ecryptfs.h:140:2: [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. syslog(type, "%s: " fmt, __FUNCTION__, ## arg); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:56:27: [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 DBGSYSLOG(x, ...) syslog(LOG_DEBUG, x, ##__VA_ARGS__) data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:647: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(r,name); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:717:25: [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. # define PyOS_snprintf _snprintf data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:719:25: [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. # define PyOS_snprintf snprintf data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:736:9: [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. res = vsnprintf(buf, sizeof(buf), fmt, ap); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:98:6: [4] (shell) system: 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. system("/sbin/modprobe ecryptfs 2>/dev/null") != -1) data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:375:4: [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("/sbin/mount.ecryptfs_private", data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:389:4: [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("/sbin/umount.ecryptfs_private", data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:417:4: [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("/bin/mount", "mount", "-i", "--no-canonicalize", "-t", "ecryptfs", fullpath_source, fullpath_target, "-o", opts, NULL); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:833:3: [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("/bin/umount", "umount", "-i", "-l", ".", NULL); data/ecryptfs-utils-111/src/utils/umount.ecryptfs.c:178:7: [4] (shell) execv: 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. rc = execv(UMOUNT_PATH, new_argv); data/ecryptfs-utils-111/tests/kernel/directory-concurrent/test.c:278:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(argv[optind], R_OK | W_OK) < 0) { data/ecryptfs-utils-111/tests/kernel/file-concurrent/test.c:322:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(argv[optind], R_OK | W_OK) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:54: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(buff, flagstr); data/ecryptfs-utils-111/tests/kernel/inotify/test.c:57:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(buff, flagstr); data/ecryptfs-utils-111/src/daemon/main.c:285:29: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((long_options_ret = getopt_long(argc, argv, short_options, data/ecryptfs-utils-111/src/daemon/main.c:349:7: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(chrootdir) == -1) { data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c:95:7: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt(argc, argv, "p:"); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:396:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. fullpath_source = realpath(source, NULL); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:404:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. fullpath_target = realpath(target, NULL); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:565:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, optstr)) != -1) { data/ecryptfs-utils-111/tests/kernel/directory-concurrent/test.c:257:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "d:")) != -1) { data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:120:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned int)max_offset); data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:132:25: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. off_t offset = (off_t)random() % max_offset; data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:141:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned int)max_offset); data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:144:25: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. off_t offset = (off_t)random() % max_offset; data/ecryptfs-utils-111/tests/kernel/file-concurrent/test.c:301:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "d:")) != -1) { data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:189:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "d:")) != -1) { data/ecryptfs-utils-111/tests/kernel/lp-509180/test.c:146:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "idx")) != -1) { data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:76:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned int)SEED); data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:83:14: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. buff[j] = random() & 0xff; data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:104:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned int)SEED); data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:116:24: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. unsigned char val = random() & 0xff; data/ecryptfs-utils-111/src/daemon/main.c:210:14: [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 ((null = open("/dev/null", O_RDWR)) == -1) { data/ecryptfs-utils-111/src/daemon/main.c:359:14: [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 *fp = fopen(pidfile, "w"); data/ecryptfs-utils-111/src/include/decision_graph.h:84: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 *mnt_opt_names[MAX_NUM_MNT_OPT_NAMES]; data/ecryptfs-utils-111/src/include/ecryptfs.h:180: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. static const char common_salt[ECRYPTFS_SALT_SIZE] = data/ecryptfs-utils-111/src/include/ecryptfs.h:203: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 key_mod_alias[ECRYPTFS_MAX_KEY_MOD_NAME_BYTES + 1]; data/ecryptfs-utils-111/src/include/ecryptfs.h:251: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 socket_file_full_path[PATH_MAX]; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_gpg.c:91: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(&blob[i], gpgsig, gpgsig_len); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_gpg.c:116: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(sig, key_mod_gpg.sig, ECRYPTFS_SIG_SIZE_HEX + 1); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:115: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(&blob[i], openssl_data->path, path_length); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:119: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(&blob[i], openssl_data->passphrase, passphrase_length); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:518: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 sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:635:8: [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(node->val, O_RDONLY); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_passphrase.c:54:8: [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(node->val, O_RDONLY); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_passphrase.c:115: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:135:40: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define PUSHSERN(x,s) do { if (blob) { memcpy(&blob[i], x, s); } i+=s; } while (0) data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:604: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 dn[1024] = {0}; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:605: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 serial[1024] = {0}; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:788: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 sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:941:23: [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). pkcs11h_setLogLevel (atoi (node->val)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:954:29: [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). pkcs11h_setPINCachePeriod (atoi (node->val)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:1140: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 (node->val, "r")) == NULL) { data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:1567: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(rcfile_fullpath, O_RDONLY)) == -1) { data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:93: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(&dst[x * 2], "%.2x", (unsigned char)src[x]); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:99: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 hash[SHA1_DIGEST_LENGTH]; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:122: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(&data[i], n, nbytes); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:126: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(&data[i], e, sizeof(e)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:141: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(&tspi_data->uuid, blob, sizeof(TSS_UUID)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:407: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(to, encdata, (*to_size)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:499: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(&new_mapper->uuid, &tspi_data.uuid, sizeof(TSS_UUID)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:522: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(to, encdata, encdata_bytes); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:563: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(tmp, &str[i], sizeof(uint32_t) * 2); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:566: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(&((BYTE *)uuid)[i/2], &l, sizeof(uint32_t)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_tspi.c:622: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(blob, &tspi_data->uuid, sizeof(TSS_UUID)); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:598:16: [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 char hex[17] = "0123456789abcdef"; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:733: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[SWIG_PYBUFFER_SIZE * 2]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1391: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 result[SWIG_BUFFER_SIZE]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1715: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 result[SWIG_BUFFER_SIZE]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1729: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 result[SWIG_BUFFER_SIZE]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1740: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 result[SWIG_BUFFER_SIZE]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1858: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(pack, ptr, size); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:1876: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(ptr, sobj->pack, size); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:2398: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 mesg[256]; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:2554:22: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:201: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(fullpath, O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:242: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 new_prefix[MAX_TOK_LEN]; data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:243: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 sub_token[MAX_TOK_LEN]; data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:297: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(name, sub_token, i); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:306: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(name, sub_token, i); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:314: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(value, &sub_token[j+1], (i - j)); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:349: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 tok_str[MAX_TOK_LEN]; data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:100: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(&(param_node->tl[param_node->num_transitions++]), data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:550: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(&prompt[i], pe->str, strlen(pe->str)); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:566:10: [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). val = atoi(node->val); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:682:17: [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). *verbosity = atoi(temp->value); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:1003: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 sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:22: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 tmp_str[sizeof(uint32_t)]; data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:25: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(tmp_str, (char *)&tmp_u32, sizeof(uint32_t)); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:48: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(&m_1, data, 4); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:51: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(&m_2, (data + 4), 4); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:88: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(&flags, buf, 4); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:116: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(&header_extent_size, buf, sizeof(uint32_t)); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:120: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(&num_header_extents_at_front, buf, sizeof(uint16_t)); data/ecryptfs-utils-111/src/libecryptfs/ecryptfs-stat.c:158: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(&file_size, buf, ECRYPTFS_FILE_SIZE_BYTES); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:118: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_tok_sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:119: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 fekek[ECRYPTFS_MAX_KEY_BYTES]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:222: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 fekek[ECRYPTFS_MAX_KEY_BYTES]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:316: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[ECRYPTFS_SIG_SIZE_HEX]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:387: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(filename, O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:412: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 decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:415: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(src, O_RDONLY)) == -1) { data/ecryptfs-utils-111/src/libecryptfs/key_management.c:451: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("/dev/urandom", O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:474:51: [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 int write_v2_wrapped_passphrase_file(const char *filename, data/ecryptfs-utils-111/src/libecryptfs/key_management.c:475:10: [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 wrapping_salt[ECRYPTFS_SALT_SIZE], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:476:10: [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 wrapping_key_sig[ECRYPTFS_SIG_SIZE_HEX], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:494: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). fd = mkstemp(temp); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:566: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 wrapping_salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:567: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 wrapping_auth_tok_sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:568: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 wrapping_key[ECRYPTFS_MAX_KEY_BYTES]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:569: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 padded_decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + data/ecryptfs-utils-111/src/libecryptfs/key_management.c:571: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 encrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + data/ecryptfs-utils-111/src/libecryptfs/key_management.c:614: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(padded_decrypted_passphrase, decrypted_passphrase, data/ecryptfs-utils-111/src/libecryptfs/key_management.c:711:50: [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 int read_v1_wrapped_passphrase_file(const char *filename, data/ecryptfs-utils-111/src/libecryptfs/key_management.c:712: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 wrapping_key_sig[ECRYPTFS_SIG_SIZE_HEX], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:713: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 encrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:722: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(filename, O_RDONLY)) == -1) { data/ecryptfs-utils-111/src/libecryptfs/key_management.c:780:50: [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 int read_v2_wrapped_passphrase_file(const char *filename, data/ecryptfs-utils-111/src/libecryptfs/key_management.c:781: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 wrapping_salt[ECRYPTFS_SALT_SIZE], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:782: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 wrapping_key_sig[ECRYPTFS_SIG_SIZE_HEX], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:783: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 encrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES], data/ecryptfs-utils-111/src/libecryptfs/key_management.c:794: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(filename, O_RDONLY)) == -1) { data/ecryptfs-utils-111/src/libecryptfs/key_management.c:848: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 v2_wrapping_salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:849: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 wrapping_auth_tok_sig[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:850: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 wrapping_auth_tok_sig_from_file[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:851: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 wrapping_key[ECRYPTFS_MAX_KEY_BYTES]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:852: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 encrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1002: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 decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1] ; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1122: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(salt_hex, nvp->value, ECRYPTFS_SALT_SIZE_HEX); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1139: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 tmp[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1145: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(sig_cache_filename, O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1169: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 tmp[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1172: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(sig_cache_filename, (O_WRONLY | O_CREAT), data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1184: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(tmp, auth_tok_sig, ECRYPTFS_SIG_SIZE_HEX); data/ecryptfs-utils-111/src/libecryptfs/key_mod.c:53: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(&key_type, key_data, sizeof(uint32_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:58: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(&dst[x*2], "%.2x", (unsigned char)src[x] ); data/ecryptfs-utils-111/src/libecryptfs/main.c:65: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 tmp[3] = { 0, }; data/ecryptfs-utils-111/src/libecryptfs/main.c:112: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). fh = fopen(mnt_file, "r"); data/ecryptfs-utils-111/src/libecryptfs/main.c:217: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 salt_and_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES data/ecryptfs-utils-111/src/libecryptfs/main.c:222: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[SHA512_DIGEST_LENGTH]; data/ecryptfs-utils-111/src/libecryptfs/main.c:234: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(salt_and_passphrase, salt, ECRYPTFS_SALT_SIZE); data/ecryptfs-utils-111/src/libecryptfs/main.c:235: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((salt_and_passphrase + ECRYPTFS_SALT_SIZE), passphrase, data/ecryptfs-utils-111/src/libecryptfs/main.c:247: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(fekek, buf, ECRYPTFS_MAX_KEY_BYTES); data/ecryptfs-utils-111/src/libecryptfs/main.c:272: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(auth_tok->token.password.salt, salt, ECRYPTFS_SALT_SIZE); data/ecryptfs-utils-111/src/libecryptfs/main.c:273: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(auth_tok->token.password.session_key_encryption_key, data/ecryptfs-utils-111/src/libecryptfs/main.c:321: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(auth_tok->token.private_key.data, key_mod->blob, data/ecryptfs-utils-111/src/libecryptfs/main.c:380: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(auth_tok->token.private_key.signature, sig, data/ecryptfs-utils-111/src/libecryptfs/main.c:560: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:563: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:569: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:572: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:605: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:608: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:620: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:623: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:660: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:663: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:675: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:678: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:692: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(tmp, &shm_virt[i], remainder); data/ecryptfs-utils-111/src/libecryptfs/main.c:694: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(&shm_virt[i], tmp, remainder); data/ecryptfs-utils-111/src/libecryptfs/main.c:739: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:742: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:753: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(&sid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:756: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(&pid_tmp, &shm_virt[i], sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:765: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(&shm_virt[i], &sid, sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/main.c:767: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(&shm_virt[i], &pid, sizeof(pid_t)); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:50: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 packet_len_str[3]; data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:81: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(&miscdev_msg_data[i], (void *)&msg_seq_be32, 4); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:84: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(&miscdev_msg_data[i], packet_len_str, packet_len_size); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:86: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(&miscdev_msg_data[i], (void *)msg, packet_len); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:140: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((void *)&msg_seq_be32, &miscdev_msg_data[i], 4); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:170: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((void *)(*msg), (void *)&miscdev_msg_data[i], packet_len); data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:180:28: [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). miscdev_ctx->miscdev_fd = open(ECRYPTFS_DEFAULT_MISCDEV_FULLPATH_0, data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:188:28: [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). miscdev_ctx->miscdev_fd = open(ECRYPTFS_DEFAULT_MISCDEV_FULLPATH_1, data/ecryptfs-utils-111/src/libecryptfs/packets.c:214: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(&data[i], key, key_size); data/ecryptfs-utils-111/src/libecryptfs/packets.c:247: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(&data[i], key, key_size); data/ecryptfs-utils-111/src/libecryptfs/packets.c:284: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(signature, &emsg->data[i], data_size); data/ecryptfs-utils-111/src/libecryptfs/packets.c:299: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(key, &emsg->data[i], key_size); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:38: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("/etc/mtab", "r"); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:47: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(mnt, mntent->mnt_dir, *mnt_size); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:56: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(mnt, "/sys", strlen("/sys")); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:66: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 version_str[16]; data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:93: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(handle, O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:99:8: [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(handle, O_RDONLY); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:111:13: [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). *version = atoi(version_str); data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:100: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 passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:135: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:136: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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:360: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). fd = open("/var/lib/update-notifier/dpkg-run-stamp", O_WRONLY|O_CREAT|O_NONBLOCK, 0666); data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:439: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:440: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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/pam_ecryptfs/pam_ecryptfs.c:517: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 passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1]; data/ecryptfs-utils-111/src/utils/ecryptfs-stat.c:25: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[4096]; data/ecryptfs-utils-111/src/utils/ecryptfs-stat.c:33: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(filename, O_RDONLY); data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:39: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_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:40: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:41: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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c:70:17: [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(&ret[i*2], "%02x%02x%02x%02x", bytes[i] & 0xff, data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c:113:6: [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). atoi(optarg); data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c:239:26: [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. uuidString = (unsigned char *) data/ecryptfs-utils-111/src/utils/ecryptfs_generate_tpm_key.c:240:32: [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. util_bytes_to_string((char *) data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c:41: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_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:41: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 passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1]; data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:44: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:45: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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.c:40: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 passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1]; data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c:46: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c:47: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 salt_hex[ECRYPTFS_SALT_SIZE_HEX]; data/ecryptfs-utils-111/src/utils/io.c:92: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(temp, *val, length); data/ecryptfs-utils-111/src/utils/io.c:163: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 str[8]; data/ecryptfs-utils-111/src/utils/io.c:180:14: [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). selection = atoi(str); data/ecryptfs-utils-111/src/utils/io.c:242: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 str[8]; data/ecryptfs-utils-111/src/utils/io.c:271: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). key_mod_type = atoi(str); data/ecryptfs-utils-111/src/utils/manager.c:38: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 passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH]; data/ecryptfs-utils-111/src/utils/manager.c:39: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 salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/src/utils/manager.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 auth_tok_sig[ECRYPTFS_SIG_SIZE_HEX+1]; data/ecryptfs-utils-111/src/utils/manager.c:59: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(salt, common_salt, ECRYPTFS_SALT_SIZE); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:84: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(*src, ptr, len); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:97: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(*target, ptr, len); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:124: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(*options, ptr, len); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:217: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(temp_end, ",", 1); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:221: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(temp_end, cur, opt_len); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:228: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(options,temp,len); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:72:8: [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). fin = fopen(fnam, "r"); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:150: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). fh = fopen(sig_file, "r"); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:369: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("/etc/mtab~", O_RDONLY | O_CREAT | O_EXCL, 0644); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:453:14: [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(f, O_RDWR | O_CREAT | O_NOFOLLOW, 0600)) >= 0) && data/ecryptfs-utils-111/src/utils/test.c:274: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 extent_iv[ECRYPTFS_MAX_IV_BYTES]; data/ecryptfs-utils-111/src/utils/test.c:446: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("ecryptfsrc", O_RDONLY); data/ecryptfs-utils-111/src/utils/umount.ecryptfs.c:73: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(*value, val_start, val_len); data/ecryptfs-utils-111/tests/kernel/directory-concurrent/test.c:260:15: [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). duration = atoi(optarg); data/ecryptfs-utils-111/tests/kernel/enospc/test.c:42: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 buff[BUFF_SZ]; data/ecryptfs-utils-111/tests/kernel/enospc/test.c:45: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(filename, O_RDWR | O_CREAT, 0600)) < 0) { data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:91: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 buffer2[BUF_SZ]; data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:117: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 buffer1[BUF_SZ]; data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:123: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(filename, O_RDWR | O_CREAT, 0600)) < 0) { data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:143: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 buffer2[BUF_SZ]; data/ecryptfs-utils-111/tests/kernel/file-concurrent/test.c:304:15: [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). duration = atoi(optarg); data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:79: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). if ((fp = fopen("/proc/sys/vm/drop_caches", "w")) != NULL) { data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:110: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 cmd[32]; data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:172: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 cmd[32]; data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:192:15: [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). duration = atoi(optarg); data/ecryptfs-utils-111/tests/kernel/inotify/test.c:67: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. static char buf[4096]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:107: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/ecryptfs-utils-111/tests/kernel/inotify/test.c:211: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[BUF_SIZE]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:215: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(filename, O_CREAT | O_RDWR, FILE_FLAGS)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:255: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:271: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[1]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:274: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(path, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:292: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:308: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[1] = { 0 }; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:314: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(path, O_RDWR)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:333: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:351: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:365: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(path, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:375: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:399: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:424: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:452: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:453: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 newpath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:483: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 olddir[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:484: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 oldfile[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:485: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 newfile[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:521: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 oldfile[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:522: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 newdir[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:523: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 newfile[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:555: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:563: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(filepath, O_RDWR)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:585: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 filepath[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/inotify/test.c:593: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(filepath, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:27: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[4096]; data/ecryptfs-utils-111/tests/kernel/llseek/test.c:38: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(path, (O_CREAT | O_EXCL| O_WRONLY), S_IRUSR | S_IWUSR); data/ecryptfs-utils-111/tests/kernel/llseek/test.c:72: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(path, (O_CREAT | O_EXCL| O_RDWR), S_IRWXU); data/ecryptfs-utils-111/tests/kernel/llseek/test.c:185: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(path, (O_RDONLY)); data/ecryptfs-utils-111/tests/kernel/lp-509180/test.c:46: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 buffer[1]; data/ecryptfs-utils-111/tests/kernel/lp-509180/test.c:170: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(file, O_RDWR, 0700)) < 0) { data/ecryptfs-utils-111/tests/kernel/lp-524919/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 link[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/lp-524919/test.c:44: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[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/lp-524919/test.c:55: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(argv[1], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) { data/ecryptfs-utils-111/tests/kernel/lp-870326/test.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[MMAP_LEN]; data/ecryptfs-utils-111/tests/kernel/lp-870326/test.c:78: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(argv[1], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) { data/ecryptfs-utils-111/tests/kernel/lp-994247/test.c:49: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). miscdev = open("/dev/ecryptfs", O_RDWR); data/ecryptfs-utils-111/tests/kernel/miscdev-bad-count/test.c:36: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). miscdev = open("/dev/ecryptfs", O_WRONLY); data/ecryptfs-utils-111/tests/kernel/mmap-bmap/test.c:39: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(filename, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/mmap-close/test.c:43: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(argv[1], O_RDWR | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR); data/ecryptfs-utils-111/tests/kernel/mmap-dir/test.c:48: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 path[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/mmap-dir/test.c:56: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(path, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/read-dir/test.c:48: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 path[PATH_MAX]; data/ecryptfs-utils-111/tests/kernel/read-dir/test.c:49: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 buff[BUFF_SIZE]; data/ecryptfs-utils-111/tests/kernel/read-dir/test.c:57: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(path, O_RDONLY)) < 0) { data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:166: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 buff[BUFF_SZ]; data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:169: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(filename, O_RDWR | O_CREAT, 0600)) < 0) { data/ecryptfs-utils-111/tests/kernel/xattr/test.c:54: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/ecryptfs-utils-111/tests/lib/etl_add_passphrase_key_to_keyring.c:30: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_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; data/ecryptfs-utils-111/tests/lib/etl_add_passphrase_key_to_keyring.c:31: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 salt[ECRYPTFS_SALT_SIZE + 1]; data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:47: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 decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:116: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 decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:143: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 wrapping_salt[ECRYPTFS_SALT_SIZE]; data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:38: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 sig_hex[ECRYPTFS_PASSWORD_SIG_SIZE + 1]; data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:39: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 fekek[ECRYPTFS_MAX_KEY_BYTES + 1]; data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:40: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 fekek_hex[ECRYPTFS_MAX_KEY_HEX_BYTES + 1]; data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:41: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 salt[ECRYPTFS_SALT_SIZE + 1]; data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.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 passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 8]; data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:18: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 decrypted_passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1]; data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:20: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 salt[ECRYPTFS_SALT_SIZE + 1]; data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:33: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(passphrase, "012345679abcdef0\0", 17); data/ecryptfs-utils-111/src/daemon/main.c:124:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((r = read (fds[0], input, input_size - 1)) == -1) { data/ecryptfs-utils-111/src/daemon/main.c:131: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 (input) > 0 && input[strlen (input)-1] == '\n') { data/ecryptfs-utils-111/src/daemon/main.c:131: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). if (strlen (input) > 0 && input[strlen (input)-1] == '\n') { data/ecryptfs-utils-111/src/daemon/main.c:132: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). input[strlen (input)-1] = '\0'; data/ecryptfs-utils-111/src/daemon/main.c:198:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(027); data/ecryptfs-utils-111/src/daemon/main.c:245: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). const char *descr = opt->name + strlen(opt->name) + 1; data/ecryptfs-utils-111/src/daemon/main.c:253: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(descr)) data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_gpg.c:88: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). gpgsig_len = strlen(gpgsig) + 1; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:108: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). path_length = strlen(openssl_data->path) + 1; /* + '\0' */ data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_openssl.c:109:22: [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). passphrase_length = strlen(openssl_data->passphrase) + 1; data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:147: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). serialized_id_length = strlen(pkcs11h_data->serialized_id) + 1; /* + '\0' */ data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:154:22: [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). passphrase_length = strlen(pkcs11h_data->passphrase) + 1; /* + '\0' */ data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:232:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (pin, (char *)user_data, pin_max-1); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:914:43: [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(ctx->pkcs11h_data.passphrase, 0, strlen(ctx->pkcs11h_data.passphrase)); data/ecryptfs-utils-111/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c:1139:27: [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 (node->val != NULL && strlen(node->val) > 0) { data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:369: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). const char* te = tb + strlen(tb); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:388: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). const char* te = tb + strlen(tb); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:646: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(name) + 1 > (bsz - (r - buff))) return 0; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:667: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). size_t lname = (name ? strlen(name) : 0); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:672:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(r,name,lname+1); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:770:91: [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). # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:2573: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 (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3133: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). size_t size = strlen(name)+1; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3136:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gv->name,name,size); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3198: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). strlen(const_table[j].name)) == 0) { data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3207: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 lptr = strlen(ty->name)+2*sizeof(void*)+2; data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3213:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buff, methods[i].ml_doc, ldoc); data/ecryptfs-utils-111/src/libecryptfs-swig/libecryptfs_wrap.c:3215:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(buff, "swig_ptr: ", 10); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:252:17: [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). tok_len = (int)strlen(tok); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:324: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(name) == 0) { data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:354: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). int buf_len = strlen(buf); data/ecryptfs-utils-111/src/libecryptfs/cmd_ln_parser.c:414:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, data + pos, buf_size - pos); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:536:19: [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). prompt_len += strlen(pe->str); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:550:33: [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). memcpy(&prompt[i], pe->str, strlen(pe->str)); data/ecryptfs-utils-111/src/libecryptfs/decision_graph.c:551: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). i += strlen(pe->str); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:282:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t bytes = read(fd, buf + rc, count - rc); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:493:14: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(S_IRWXG | S_IRWXO); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:495:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:589:31: [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). decrypted_passphrase_bytes = strlen(decrypted_passphrase); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1119: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). valsize = strlen(nvp->value); data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1150:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((size = read(fd, tmp, (ECRYPTFS_SIG_SIZE_HEX + 1))) data/ecryptfs-utils-111/src/libecryptfs/key_management.c:1261: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(passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/libecryptfs/key_mod.c:269: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). dir_length = strlen(ep->d_name); data/ecryptfs-utils-111/src/libecryptfs/key_mod.c:409: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). strlen(curr->alias))) { data/ecryptfs-utils-111/src/libecryptfs/main.c:226:20: [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). passphrase_size = strlen(passphrase); data/ecryptfs-utils-111/src/libecryptfs/main.c:270:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)auth_tok->token.password.signature, passphrase_sig, data/ecryptfs-utils-111/src/libecryptfs/main.c:375:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(auth_tok->token.private_key.key_mod_alias, key_mod->alias, data/ecryptfs-utils-111/src/libecryptfs/miscdev.c:122:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_bytes = read(miscdev_ctx->miscdev_fd, miscdev_msg_data, data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:45: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). *mnt_size = strlen(mntent->mnt_dir); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:54: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). *mnt_size = strlen("/sys"); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:56: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). memcpy(mnt, "/sys", strlen("/sys")); data/ecryptfs-utils-111/src/libecryptfs/sysfs.c:105:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read(fd, version_str, 16); data/ecryptfs-utils-111/src/utils/ecryptfs-stat.c:40:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). quant_read = read(fd, buf, 4096); data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:50: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). strlen(argv[1]) == 6 && strncmp(argv[1], "--fnek", 6) == 0) { data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:55: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). strlen(argv[1]) == 1 && strncmp(argv[1], "-", 1) == 0) { data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:60: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). (strlen(argv[1])==6 && strncmp(argv[1], "--fnek", 6)==0) && data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:61: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). (strlen(argv[2])==1 && strncmp(argv[2], "-", 1)==0)) { data/ecryptfs-utils-111/src/utils/ecryptfs_add_passphrase.c:69: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). strlen(passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c:59: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). strlen(argv[2]) == 1 && strncmp(argv[2], "-", 1) == 0) { data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c:64: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). (strlen(argv[2]) != 1 || strncmp(argv[2], "-", 1) != 0)) { data/ecryptfs-utils-111/src/utils/ecryptfs_insert_wrapped_passphrase_into_keyring.c:73: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). strlen(wrapping_passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:74: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). && strlen(argv[2]) == 1 && strncmp(argv[2], "-", 1) == 0) { data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:87: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). strlen(old_wrapping_passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH || data/ecryptfs-utils-111/src/utils/ecryptfs_rewrap_passphrase.c:88: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). strlen(new_wrapping_passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.c:59: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). strlen(argv[2]) == 1 && strncmp(argv[2], "-", 1) == 0) { data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.c:64: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). (strlen(argv[2]) != 1 || strncmp(argv[2], "-", 1) == 0)) { data/ecryptfs-utils-111/src/utils/ecryptfs_unwrap_passphrase.c:73: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). strlen(wrapping_passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c:56: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). } else if (argc == 3 && strlen(argv[2]) == 1 && data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c:71: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). strlen(passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH || data/ecryptfs-utils-111/src/utils/ecryptfs_wrap_passphrase.c:72: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). strlen(wrapping_passphrase) > ECRYPTFS_MAX_PASSWORD_LENGTH) { data/ecryptfs-utils-111/src/utils/io.c:55:10: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getchar(); data/ecryptfs-utils-111/src/utils/io.c:179: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). str[strlen(str)] = '\0'; data/ecryptfs-utils-111/src/utils/io.c:267: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). str[strlen(str)] = '\0'; data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:77: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). len = strlen(ptr) + 1; /* + NULL terminator */ data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:90: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). len = strlen(ptr) + 1; /* + NULL-terminator */ data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:116: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). len = strlen(ptr) + 1; /* + NULL-terminator */ data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:199: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). len = (strlen(options) + 1); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:220: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). opt_len = strlen(cur); data/ecryptfs-utils-111/src/utils/mount.ecryptfs.c:336:19: [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). int option_len = strlen(option); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:115: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(u); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:182: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). for (j=0; j<strlen(sig[i]); j++) { data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:192: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(sig[i]) > 0 && strlen(sig[i]) != KEY_BYTES) { data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:192: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 (strlen(sig[i]) > 0 && strlen(sig[i]) != KEY_BYTES) { data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:368:14: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(033); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:421:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:432:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/ecryptfs-utils-111/src/utils/mount.ecryptfs_private.c:686: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). if (opts2 != NULL && strlen(opts2) != 0 && strcmp(opts2, "none") != 0) { data/ecryptfs-utils-111/src/utils/umount.ecryptfs.c:50: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). name_len = strlen(name); data/ecryptfs-utils-111/src/utils/umount.ecryptfs.c:65: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). val_stop = mnt_opts + strlen(mnt_opts); data/ecryptfs-utils-111/tests/kernel/directory-concurrent/test.c:154: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(path) + 32; data/ecryptfs-utils-111/tests/kernel/extend-file-random/test.c:76:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, buffer, len); data/ecryptfs-utils-111/tests/kernel/file-concurrent/test.c:182: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(path) + 32; data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:112:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((n = read(fdin, cmd, sizeof(cmd))) < 1) { data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:312: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 (write(pipe_to[i][1], cmd, strlen(cmd)+1) < 0) { data/ecryptfs-utils-111/tests/kernel/inode-race-stat/test.c:325:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((n = read(pipe_from[i][0], cmd, 1)) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:56:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buff, " "); data/ecryptfs-utils-111/tests/kernel/inotify/test.c:152:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(fd, buffer, sizeof(buffer))) < 0) { data/ecryptfs-utils-111/tests/kernel/inotify/test.c:280:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buffer, 1) < 0) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:109:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4)) != 4) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:120:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 1020)) != 1020) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:134:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4)) != 4) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:145:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 1)) != 0) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:157:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4096)) != 4096) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:192:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4096)) != 4096) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:206:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4)) != 4) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:217:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 1020)) != 1020) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:231:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 4)) != 4) { data/ecryptfs-utils-111/tests/kernel/llseek/test.c:242:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((size = read(fd, buf, 1)) != 0) { data/ecryptfs-utils-111/tests/kernel/lp-509180/test.c:54:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) { data/ecryptfs-utils-111/tests/kernel/lp-870326/test.c:117: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). if ((n = strlen(klog_before)) > 0) { data/ecryptfs-utils-111/tests/kernel/read-dir/test.c:62:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buff, sizeof(buff)); data/ecryptfs-utils-111/tests/kernel/trunc-file/test.c:63:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, ptr, sz); data/ecryptfs-utils-111/tests/kernel/xattr/test.c:76:19: [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). names_len = 1 + strlen(XATTR_METADATA_NAME); data/ecryptfs-utils-111/tests/kernel/xattr/test.c:80:43: [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 (setxattr(file, names[i], values[i], strlen(values[i]), 0) < 0) data/ecryptfs-utils-111/tests/kernel/xattr/test.c:82:20: [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). names_len += 1 + strlen(names[i]); data/ecryptfs-utils-111/tests/kernel/xattr/test.c:101: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). for (ptr = buffer; *ptr; ptr += strlen(ptr) + 1) { data/ecryptfs-utils-111/tests/kernel/xattr/test.c:139:20: [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). names_len -= 1 + strlen(names[i]); data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:83:32: [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). last = wrapping_passphrase + (strlen(wrapping_passphrase) - 1); data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:158: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(expected_decrypted_passphrase) > ECRYPTFS_MAX_PASSPHRASE_BYTES || data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:159: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). strlen(wrapping_passphrase) > ECRYPTFS_MAX_PASSPHRASE_BYTES || data/ecryptfs-utils-111/tests/userspace/v1-to-v2-wrapped-passphrase/test.c:160: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). strlen(wrapping_salt_hex) != ECRYPTFS_SALT_SIZE_HEX) { data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:45: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). strlen(argv[2]) != ECRYPTFS_SALT_SIZE_HEX || data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:46: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). strlen(argv[3]) != ECRYPTFS_PASSWORD_SIG_SIZE || data/ecryptfs-utils-111/tests/userspace/verify-passphrase-sig/test.c:47: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). strlen(argv[4]) != ECRYPTFS_MAX_KEY_HEX_BYTES) { data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:34:20: [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). passphrase_size = strlen(passphrase); data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:49: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). decrypted_passphrase_size = strlen(decrypted_passphrase); data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:82:31: [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). decrypted_passphrase_size = strlen(decrypted_passphrase); data/ecryptfs-utils-111/tests/userspace/wrap-unwrap/test.c:101:20: [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). passphrase_size = strlen(passphrase); ANALYSIS SUMMARY: Hits = 447 Lines analyzed = 23374 in approximately 1.25 seconds (18692 lines/second) Physical Source Lines of Code (SLOC) = 18280 Hits@level = [0] 841 [1] 128 [2] 279 [3] 18 [4] 18 [5] 4 Hits@level+ = [0+] 1288 [1+] 447 [2+] 319 [3+] 40 [4+] 22 [5+] 4 Hits/KSLOC@level+ = [0+] 70.4595 [1+] 24.453 [2+] 17.4508 [3+] 2.18818 [4+] 1.2035 [5+] 0.218818 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.