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/cryptmount-5.3.2/armour-gcry.c Examining data/cryptmount-5.3.2/dmutils.c Examining data/cryptmount-5.3.2/utils.h Examining data/cryptmount-5.3.2/looputils.h Examining data/cryptmount-5.3.2/cmtesting.h Examining data/cryptmount-5.3.2/tables.h Examining data/cryptmount-5.3.2/cryptmount.h Examining data/cryptmount-5.3.2/armour.c Examining data/cryptmount-5.3.2/utils.c Examining data/cryptmount-5.3.2/cmtesting.c Examining data/cryptmount-5.3.2/tables.c Examining data/cryptmount-5.3.2/dmutils.h Examining data/cryptmount-5.3.2/blowfish.c Examining data/cryptmount-5.3.2/cryptmount.c Examining data/cryptmount-5.3.2/armour.h Examining data/cryptmount-5.3.2/fsutils.c Examining data/cryptmount-5.3.2/fsutils.h Examining data/cryptmount-5.3.2/armour-builtin.c Examining data/cryptmount-5.3.2/looputils.c Examining data/cryptmount-5.3.2/armour-luks.c Examining data/cryptmount-5.3.2/blowfish.h FINAL RESULTS: data/cryptmount-5.3.2/cryptmount.c:813:14: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. || chown(oldfname, 0, 0) != 0 data/cryptmount-5.3.2/cryptmount.c:814:14: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. || chmod(oldfname, S_IRUSR | S_IWUSR) != 0) { data/cryptmount-5.3.2/cryptmount.c:821:14: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. || chown(tgt->key.filename, sbuff.st_uid, sbuff.st_gid) != 0 data/cryptmount-5.3.2/cryptmount.c:822:14: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. || chmod(tgt->key.filename, sbuff.st_mode) != 0) { data/cryptmount-5.3.2/cryptmount.c:933:14: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. || chown(tgt->key.filename, 0, 0) != 0 data/cryptmount-5.3.2/cryptmount.c:934:14: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. || chmod(tgt->key.filename, S_IRUSR | S_IWUSR) != 0) { data/cryptmount-5.3.2/fsutils.c:415:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(ETCMTABTMP, sbuff.st_uid, sbuff.st_gid) != 0 data/cryptmount-5.3.2/fsutils.c:416:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. || chmod(ETCMTABTMP, sbuff.st_mode) != 0) { data/cryptmount-5.3.2/tables.c:941:10: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. || chown(oldfname, (uid_t)0, (gid_t)0) != 0 data/cryptmount-5.3.2/tables.c:942:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. || chmod(oldfname, S_IWUSR|S_IRUSR | S_IRGRP | S_IROTH) != 0) { data/cryptmount-5.3.2/armour-luks.c:107:13: [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(*mode, fullname + divpos + 1); data/cryptmount-5.3.2/armour.c:479:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "Key read-write, %s, keylen=%d", data/cryptmount-5.3.2/armour.c:555:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "/tmp/%s_%s_%s_%s_0", PACKAGE_VERSION, km->ident, data/cryptmount-5.3.2/armour.c:594:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(keyglob, sizeof(keyglob), CM_SRCDIR "/testing/keys/[0-9]*[0-9]"); data/cryptmount-5.3.2/armour.c:608:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(keyglob, keypath); data/cryptmount-5.3.2/cryptmount.c:435:16: [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. buffpos += snprintf(dmparams + buffpos, (dpsize - buffpos), data/cryptmount-5.3.2/cryptmount.c:1005:17: [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(DLGT_UMOUNT, "umount", devname, NULL); data/cryptmount-5.3.2/cryptmount.c:1216:13: [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(prio, syslogmsg, elt->tgt->ident, username, data/cryptmount-5.3.2/fsutils.c:162:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errstr, "mounting \"%s\" on \"%s\" failed", mntdev, tgt->dir); data/cryptmount-5.3.2/fsutils.c:212:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errstr, "unmounting \"%s\" failed", tgt->dir); data/cryptmount-5.3.2/fsutils.c:614:13: [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. execv(path, (char *const *)argv); data/cryptmount-5.3.2/fsutils.c:656:13: [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, optsrc[idx]); data/cryptmount-5.3.2/fsutils.c:657:30: [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). if (idx < limit) strcat(buff, SEP); data/cryptmount-5.3.2/looputils.c:89:13: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(loopname, sizeof(loopname), data/cryptmount-5.3.2/looputils.c:122:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(dev, loop_formats[0], &devno); data/cryptmount-5.3.2/looputils.c:178:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(dev, loop_formats[0], &devno); data/cryptmount-5.3.2/looputils.c:203:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(str, loop_formats[idx], min); data/cryptmount-5.3.2/looputils.c:258:13: [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(loopdev, prefdev); data/cryptmount-5.3.2/tables.c:419:13: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(src, FMT, &qv) == 1) { \ data/cryptmount-5.3.2/utils.c:244:12: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). return strcpy(cpy, orig); data/cryptmount-5.3.2/utils.c:491:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(*buff, tmppass); data/cryptmount-5.3.2/utils.c:500:15: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. tmppass = getpass(prompt); data/cryptmount-5.3.2/utils.c:503:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(*buff, tmppass); data/cryptmount-5.3.2/utils.c:525:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(prompt, sizeof(prompt), data/cryptmount-5.3.2/utils.c:565:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(*passwd, tmppass); data/cryptmount-5.3.2/cryptmount.c:1389:19: [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. optchar = getopt_long(argc, argv, shortopts, longopts, &idx); data/cryptmount-5.3.2/cryptmount.c:1391:19: [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. optchar = getopt(argc, argv, shortopts); data/cryptmount-5.3.2/armour-builtin.c:86:15: [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 *pass, size_t passlen, uint32_t iv[2]) data/cryptmount-5.3.2/armour-builtin.c:115:15: [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 *pass, size_t passlen, uint32_t iterations, uint32_t iv[2]) data/cryptmount-5.3.2/armour-builtin.c:152: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 buff[32]; data/cryptmount-5.3.2/armour-builtin.c:162:32: [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). bltior->fversion = atoi(fmtptr + 1); data/cryptmount-5.3.2/armour-builtin.c:297: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(*key, buff, (size_t)*keylen); data/cryptmount-5.3.2/armour-gcry.c:322:9: [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*)prev, (const void*)buff, mdlen); data/cryptmount-5.3.2/armour-gcry.c:400: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 buff[32]; data/cryptmount-5.3.2/armour-gcry.c:430: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 buff[32]; data/cryptmount-5.3.2/armour-gcry.c:543: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(*key, buff, (size_t)*keylen); data/cryptmount-5.3.2/armour-gcry.c:699: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(*key, buff, (size_t)*keylen); data/cryptmount-5.3.2/armour-gcry.c:745: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((void*)buff, (const void*)key, (size_t)keylen); data/cryptmount-5.3.2/armour-luks.c:67: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 buff[32]; data/cryptmount-5.3.2/armour-luks.c:182:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(boundtgt->tgt->key.filename, "rb"); data/cryptmount-5.3.2/armour-luks.c:242: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 logmsg[256]; data/cryptmount-5.3.2/armour-luks.c:252:9: [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(logmsg, "kmluks created keyslot backup %d -> %d", data/cryptmount-5.3.2/armour-luks.c:261:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(logmsg, "kmluks added keyslot %d", new_slot); data/cryptmount-5.3.2/armour-luks.c:268:9: [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(logmsg, "kmluks removed keyslot backup %d", bckp_slot); data/cryptmount-5.3.2/armour-luks.c:379: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 msgbuff[1024]; data/cryptmount-5.3.2/armour.c:129: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 buff[BUFFSZ]; data/cryptmount-5.3.2/armour.c:149:9: [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*)(*key + *keylen), (const void*)buff, len); data/cryptmount-5.3.2/armour.c:320:18: [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_key = fopen(tgt->key.filename, "rb"); data/cryptmount-5.3.2/armour.c:358: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). fp = fopen(keyinfo->filename, "rb"); data/cryptmount-5.3.2/armour.c:459: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 str[256]; data/cryptmount-5.3.2/armour.c:489:18: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fp = tmpfile(); data/cryptmount-5.3.2/armour.c:535: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 filename[256]; data/cryptmount-5.3.2/armour.c:560: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). fp = fopen(filename, "wb"); /* May need to be "r+b" for LUKS */ data/cryptmount-5.3.2/armour.c:585: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 *tokbuff, keyglob[1024]; data/cryptmount-5.3.2/armour.c:681:9: [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(buff+2*i, "%02x", (unsigned)(key[i])); data/cryptmount-5.3.2/blowfish.c:378: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((void*)ctxt->p, (const void*)bf_p, sizeof(bf_p)); data/cryptmount-5.3.2/blowfish.c:379: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((void*)ctxt->sbox, (const void*)bf_sbox, sizeof(bf_sbox)); data/cryptmount-5.3.2/cryptmount.c:185: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). fd = open(*dev, O_RDONLY); data/cryptmount-5.3.2/cryptmount.c:224: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(device, O_RDONLY); data/cryptmount-5.3.2/cryptmount.c:793:18: [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(newfname, "wb"); data/cryptmount-5.3.2/cryptmount.c:796:18: [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(tgt->key.filename, "r+b"); data/cryptmount-5.3.2/cryptmount.c:914:18: [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(newfname, "wb"); data/cryptmount-5.3.2/cryptmount.c:917:18: [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(tgt->key.filename, (fileexists ? "r+b" : "wb")); data/cryptmount-5.3.2/dmutils.c:337:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(path, "rb"); data/cryptmount-5.3.2/fsutils.c:181: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. const char *argv[16]; data/cryptmount-5.3.2/fsutils.c:231: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. const char *argv[16]; data/cryptmount-5.3.2/fsutils.c:261: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. const char *argv[8]; data/cryptmount-5.3.2/fsutils.c:549: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(dev, O_RDONLY | O_NOATIME); data/cryptmount-5.3.2/fsutils.c:603:22: [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/null", O_WRONLY); data/cryptmount-5.3.2/fsutils.c:637: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 **opttable, buff[256]; data/cryptmount-5.3.2/fsutils.c:684: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 fname[256]; data/cryptmount-5.3.2/fsutils.c:693:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fname, "/tmp/cm-%u-entropy", (unsigned)getpid()); data/cryptmount-5.3.2/fsutils.c:702: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). fp = fopen(fname, "wb"); data/cryptmount-5.3.2/looputils.c:74: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 loopname[256] = ""; data/cryptmount-5.3.2/looputils.c:78:13: [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). devfd = open("/dev/loop-control", O_RDWR); data/cryptmount-5.3.2/looputils.c:92:21: [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). devfd = open(loopname, O_RDONLY); data/cryptmount-5.3.2/looputils.c:117:13: [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). devfd = open(dev, flags); data/cryptmount-5.3.2/looputils.c:123:17: [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). ctlfd = open("/dev/loop-control", O_RDWR); data/cryptmount-5.3.2/looputils.c:126:17: [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). devfd = open(dev, flags); data/cryptmount-5.3.2/looputils.c:134: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). filefd = open(file, flags); data/cryptmount-5.3.2/looputils.c:162:13: [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). devfd = open(dev, O_RDONLY); data/cryptmount-5.3.2/looputils.c:179:15: [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). ctlfd = open("/dev/loop-control", O_RDWR); data/cryptmount-5.3.2/looputils.c:197: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 str[256]; data/cryptmount-5.3.2/looputils.c:218: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 buff[256]; data/cryptmount-5.3.2/tables.c:149: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 buff[512]; data/cryptmount-5.3.2/tables.c:157:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buff, "%d", (int)uid); data/cryptmount-5.3.2/tables.c:166:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buff, "%d", (int)gid); data/cryptmount-5.3.2/tables.c:381: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 answer[1024], *buff = NULL; data/cryptmount-5.3.2/tables.c:392:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(answer, "nothing-%d here", getuid()); data/cryptmount-5.3.2/tables.c:654:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(cfgname, "r"); data/cryptmount-5.3.2/tables.c:671: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 label[64]; data/cryptmount-5.3.2/tables.c:737: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 buff[256]; data/cryptmount-5.3.2/tables.c:740:15: [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(fname, mode)) != NULL) { data/cryptmount-5.3.2/utils.c:57:9: [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(str->buffer, val, len + 1); data/cryptmount-5.3.2/utils.c:100: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((void*)(str->buffer + str->size), data/cryptmount-5.3.2/utils.c:127: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((void*)(str->buffer + str->size), addend, addlen + 1); data/cryptmount-5.3.2/utils.c:329:9: [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*)(memarr + 1), (const void*)ptr, oldsz); data/cryptmount-5.3.2/utils.c:404: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). fd = open(rndsrc->name, O_RDONLY | O_NONBLOCK); data/cryptmount-5.3.2/utils.c:416:17: [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(pool, devbuff, nread); data/cryptmount-5.3.2/utils.c:446:9: [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*)(buff + pos),(const void*)mdval, step); data/cryptmount-5.3.2/utils.c:450:9: [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(pool, mdval, mdlen); data/cryptmount-5.3.2/utils.c:469: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 tmppass[2048]; data/cryptmount-5.3.2/utils.c:524: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 prompt[BUFFSZ]; data/cryptmount-5.3.2/utils.c:579: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 response[64]; data/cryptmount-5.3.2/utils.c:617: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(buff, key, (size_t)keylen); data/cryptmount-5.3.2/utils.c:867:9: [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*)permsalt, (const void*)salt, saltlen); data/cryptmount-5.3.2/utils.c:913:17: [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*)(*key + pos), (const void*)mdval, sz); data/cryptmount-5.3.2/utils.h:36: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. const char *argpasswd[2]; /* Password(s) passed via command-line */ data/cryptmount-5.3.2/armour-builtin.c:240:55: [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). ctxt = kmblti_initcipher_v0(salt, passwd, strlen(passwd), iv); data/cryptmount-5.3.2/armour-builtin.c:244:55: [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). ctxt = kmblti_initcipher_v1(salt, passwd, strlen(passwd), data/cryptmount-5.3.2/armour-builtin.c:361:55: [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). ctxt = kmblti_initcipher_v0(salt, passwd, strlen(passwd), iv); data/cryptmount-5.3.2/armour-builtin.c:364:55: [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). ctxt = kmblti_initcipher_v1(salt, passwd, strlen(passwd), data/cryptmount-5.3.2/armour-gcry.c:512:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). salt, NULL, passwd, strlen(passwd), &chd); data/cryptmount-5.3.2/armour-gcry.c:595:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). salt, NULL, passwd, strlen(passwd), &chd); data/cryptmount-5.3.2/armour-gcry.c:658:58: [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). salt, kmgcryossl_keybuilder, passwd, strlen(passwd), &chd); data/cryptmount-5.3.2/armour-gcry.c:750:58: [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). salt, kmgcryossl_keybuilder, passwd, strlen(passwd), &chd); data/cryptmount-5.3.2/armour-gcry.c:790:48: [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). gcry_md_write(mdcontext, (const void*)str, strlen(str)); data/cryptmount-5.3.2/armour-gcry.c:796: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). CM_ASSERT_EQUAL(strlen(hash)/2, mdlen); data/cryptmount-5.3.2/armour-luks.c:101:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*cipher, fullname, divpos); data/cryptmount-5.3.2/armour-luks.c:240: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). { const size_t passwdlen = strlen(passwd); data/cryptmount-5.3.2/armour-luks.c:317:65: [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). CRYPT_ANY_SLOT, passwd, strlen(passwd), data/cryptmount-5.3.2/armour-luks.c:345: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). passwd, strlen(passwd)); data/cryptmount-5.3.2/armour-luks.c:418:53: [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). passwd, strlen(passwd)); data/cryptmount-5.3.2/armour.c:563: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). strlen(km_legacy_key), fp); data/cryptmount-5.3.2/armour.c:636: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). CM_ASSERT_EQUAL(strlen(km_legacy_key), keylen); data/cryptmount-5.3.2/armour.c:725: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). pos = (int)strlen(cmtab); data/cryptmount-5.3.2/blowfish.c:451: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). strlen(tvecs[idx].key)); data/cryptmount-5.3.2/cryptmount.c:788:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sz = strlen(tgt->key.filename) + 16; data/cryptmount-5.3.2/cryptmount.c:911:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sz = strlen(tgt->key.filename) + 16; data/cryptmount-5.3.2/dmutils.c:85: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). pfxlen = strlen(dm_dir()); data/cryptmount-5.3.2/dmutils.c:86: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). sfxlen = strlen(ident); data/cryptmount-5.3.2/fsutils.c:98:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(opttable[*argc], pos, optlen); data/cryptmount-5.3.2/fsutils.c:161:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). errstr = (char*)malloc((size_t)(strlen(mntdev) + strlen(tgt->dir) + 64)); data/cryptmount-5.3.2/fsutils.c:161:54: [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). errstr = (char*)malloc((size_t)(strlen(mntdev) + strlen(tgt->dir) + 64)); data/cryptmount-5.3.2/fsutils.c:211:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). errstr = (char*)malloc((size_t)(strlen(tgt->dir) + 64)); data/cryptmount-5.3.2/fsutils.c:558:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). step = read(fd, (void*)buff, chunk); data/cryptmount-5.3.2/looputils.c:101:32: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). if (found && buff != NULL) strncpy(buff, loopname, buffsz); data/cryptmount-5.3.2/looputils.c:113:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char*)lpinfo.lo_file_name, file, (size_t)LO_NAME_SIZE); data/cryptmount-5.3.2/looputils.c:209:32: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). if (found && buff != NULL) strncpy(buff, str, buffsz); data/cryptmount-5.3.2/looputils.c:257:46: [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). loopdev = (char*)malloc((size_t)(strlen(prefdev) + 1)); data/cryptmount-5.3.2/tables.c:319: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). { const size_t srclen = strlen(src); data/cryptmount-5.3.2/tables.c:578:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(fp); data/cryptmount-5.3.2/tables.c:809:38: [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). fprintf(sf->fp, "%u,", (unsigned)strlen(stat->ident)); data/cryptmount-5.3.2/tables.c:992:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(sf->fp) != ',') intact = 0; data/cryptmount-5.3.2/utils.c:55:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const size_t len = strlen(val); data/cryptmount-5.3.2/utils.c:123:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). { const size_t addlen = (addend != NULL ? strlen(addend) : 0); data/cryptmount-5.3.2/utils.c:226: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). pfxlen = strlen(pfx); data/cryptmount-5.3.2/utils.c:227: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). sfxlen = strlen(file); data/cryptmount-5.3.2/utils.c:242: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). cpy = (char*)malloc(strlen(orig) + 1); data/cryptmount-5.3.2/utils.c:408:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(fd, pool, POOL_SIZE); data/cryptmount-5.3.2/utils.c:412:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(fd, devbuff, NOISE_CHUNK); data/cryptmount-5.3.2/utils.c:487: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). pwlen = strlen(tmppass); data/cryptmount-5.3.2/utils.c:501: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). pwlen = strlen(tmppass); data/cryptmount-5.3.2/utils.c:550:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*passwd, (argpw != NULL ? argpw : ""), (size_t)1024); data/cryptmount-5.3.2/utils.c:561: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). plen = strlen(tmppass); data/cryptmount-5.3.2/utils.c:591:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). rlen = strlen(response); data/cryptmount-5.3.2/utils.c:824: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). strlen(cases[idx].input)); data/cryptmount-5.3.2/utils.c:858: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). pwlen = strlen(passwd); data/cryptmount-5.3.2/utils.c:1014:49: [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). (uint8_t*)tcases[idx].salt, strlen(tcases[idx].salt), ANALYSIS SUMMARY: Hits = 169 Lines analyzed = 9258 in approximately 0.33 seconds (27684 lines/second) Physical Source Lines of Code (SLOC) = 6238 Hits@level = [0] 200 [1] 51 [2] 81 [3] 2 [4] 25 [5] 10 Hits@level+ = [0+] 369 [1+] 169 [2+] 118 [3+] 37 [4+] 35 [5+] 10 Hits/KSLOC@level+ = [0+] 59.1536 [1+] 27.092 [2+] 18.9163 [3+] 5.93139 [4+] 5.61077 [5+] 1.60308 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.