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/libaacs-0.9.0/src/examples/aacs_info.c Examining data/libaacs-0.9.0/src/examples/parser_test.c Examining data/libaacs-0.9.0/src/libaacs/unit_key.h Examining data/libaacs-0.9.0/src/libaacs/content_cert.c Examining data/libaacs-0.9.0/src/libaacs/unit_key.c Examining data/libaacs-0.9.0/src/libaacs/content_cert.h Examining data/libaacs-0.9.0/src/libaacs/cci_data.h Examining data/libaacs-0.9.0/src/libaacs/aacs.h Examining data/libaacs-0.9.0/src/libaacs/crypto.h Examining data/libaacs-0.9.0/src/libaacs/mmc.c Examining data/libaacs-0.9.0/src/libaacs/crypto.c Examining data/libaacs-0.9.0/src/libaacs/ec.c Examining data/libaacs-0.9.0/src/libaacs/mkb.c Examining data/libaacs-0.9.0/src/libaacs/mkb.h Examining data/libaacs-0.9.0/src/libaacs/mmc.h Examining data/libaacs-0.9.0/src/libaacs/cci.h Examining data/libaacs-0.9.0/src/libaacs/aacs.c Examining data/libaacs-0.9.0/src/libaacs/cci.c Examining data/libaacs-0.9.0/src/file/file_posix.c Examining data/libaacs-0.9.0/src/file/file.h Examining data/libaacs-0.9.0/src/file/keydbcfg.c Examining data/libaacs-0.9.0/src/file/dirs_darwin.c Examining data/libaacs-0.9.0/src/file/mmc_device_darwin.c Examining data/libaacs-0.9.0/src/file/file_win32.c Examining data/libaacs-0.9.0/src/file/path.h Examining data/libaacs-0.9.0/src/file/dirs_win32.c Examining data/libaacs-0.9.0/src/file/mmc_device_linux.c Examining data/libaacs-0.9.0/src/file/filesystem.h Examining data/libaacs-0.9.0/src/file/path.c Examining data/libaacs-0.9.0/src/file/filesystem.c Examining data/libaacs-0.9.0/src/file/file.c Examining data/libaacs-0.9.0/src/file/mmc_device_win32.c Examining data/libaacs-0.9.0/src/file/keydb.h Examining data/libaacs-0.9.0/src/file/mmc_device.h Examining data/libaacs-0.9.0/src/file/keydbcfg.h Examining data/libaacs-0.9.0/src/file/dirs.h Examining data/libaacs-0.9.0/src/file/dirs_xdg.c Examining data/libaacs-0.9.0/src/util/logging.h Examining data/libaacs-0.9.0/src/util/strutl.c Examining data/libaacs-0.9.0/src/util/attributes.h Examining data/libaacs-0.9.0/src/util/strutl.h Examining data/libaacs-0.9.0/src/util/logging.c Examining data/libaacs-0.9.0/src/util/macro.h FINAL RESULTS: data/libaacs-0.9.0/src/file/path.c:101: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. n = readlink(resolved_path, link, AACS_PATH_MAX - 1); data/libaacs-0.9.0/src/file/dirs_xdg.c:104: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(dirs, xdg_sys); data/libaacs-0.9.0/src/file/keydbcfg.c:550:51: [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. static int _load_config_file(config_file *cf, int system) data/libaacs-0.9.0/src/file/keydbcfg.c:558:9: [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. if (system) { data/libaacs-0.9.0/src/file/path.c:46: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(tmp_path, path); data/libaacs-0.9.0/src/file/path.c:125: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(link, path); data/libaacs-0.9.0/src/file/path.c:126: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(tmp_path, link); data/libaacs-0.9.0/src/util/logging.c:73:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pt += sprintf(buffer, "%s:%d: ", f ? f + 1 : file, line); data/libaacs-0.9.0/src/util/logging.c:76: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. vsnprintf(pt, sizeof(buffer) - (size_t)(intptr_t)(pt - buffer) - 1, format, args); data/libaacs-0.9.0/src/util/strutl.c:193:15: [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. len = vsnprintf(str, size, fmt, ap); data/libaacs-0.9.0/src/file/dirs_darwin.c:43:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_darwin.c:54:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_darwin.c:65:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:45:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_home = getenv("XDG_CONFIG_HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:50:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:61:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_home = getenv("XDG_DATA_HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:66:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:77:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_cache = getenv("XDG_CACHE_HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:82:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *user_home = getenv("HOME"); data/libaacs-0.9.0/src/file/dirs_xdg.c:96:31: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *xdg_sys = getenv("XDG_CONFIG_DIRS"); data/libaacs-0.9.0/src/libaacs/aacs.c:1156:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. aacs->no_cache = !!getenv("AACS_NO_CACHE"); data/libaacs-0.9.0/src/util/logging.c:51:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("AACS_DEBUG_MASK"))) data/libaacs-0.9.0/src/util/logging.c:53:25: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. else if ((env = getenv("BD_DEBUG_MASK"))) data/libaacs-0.9.0/src/util/logging.c:57:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((env = getenv("AACS_DEBUG_FILE"))) { data/libaacs-0.9.0/src/examples/parser_test.c:57: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 tmp[256]; data/libaacs-0.9.0/src/examples/parser_test.c:114: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 tmp[256]; data/libaacs-0.9.0/src/examples/parser_test.c:135: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 tmp[256]; data/libaacs-0.9.0/src/file/dirs_win32.c:43:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libaacs-0.9.0/src/file/dirs_win32.c:68:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libaacs-0.9.0/src/file/file_posix.c:133: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). if ((fd = open(filename, flags, mode)) < 0) { data/libaacs-0.9.0/src/file/file_win32.c:92:5: [2] (buffer) wchar_t: 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. wchar_t wfilename[MAX_PATH], wmode[8]; data/libaacs-0.9.0/src/file/file_win32.c:94:10: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, MAX_PATH) || data/libaacs-0.9.0/src/file/file_win32.c:95:10: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). !MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8)) { data/libaacs-0.9.0/src/file/file_win32.c:129:5: [2] (buffer) wchar_t: 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. wchar_t wfile[MAX_PATH]; data/libaacs-0.9.0/src/file/file_win32.c:131:5: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, file, -1, wfile, MAX_PATH); data/libaacs-0.9.0/src/file/file_win32.c:137:5: [2] (buffer) wchar_t: 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. wchar_t wpath[MAX_PATH]; data/libaacs-0.9.0/src/file/file_win32.c:139:5: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, MAX_PATH); data/libaacs-0.9.0/src/file/file_win32.c:150:5: [2] (buffer) wchar_t: 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. wchar_t wdir[MAX_PATH]; data/libaacs-0.9.0/src/file/file_win32.c:152:5: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, dir, -1, wdir, MAX_PATH); data/libaacs-0.9.0/src/file/keydb.h:25: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(out, in, size); data/libaacs-0.9.0/src/file/keydbcfg.c:310: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 disc_id_str[41]; data/libaacs-0.9.0/src/file/mmc_device_darwin.c:80: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 bsd_name[128]; data/libaacs-0.9.0/src/file/mmc_device_darwin.c:141: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[512]; data/libaacs-0.9.0/src/file/mmc_device_darwin.c:285: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 name[128] = ""; data/libaacs-0.9.0/src/file/mmc_device_linux.c:65: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[512]; data/libaacs-0.9.0/src/file/mmc_device_linux.c:69: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(cgc.cmd, cmd, CDROM_PACKET_SIZE); data/libaacs-0.9.0/src/file/mmc_device_linux.c:114: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 resolved_path[AACS_PATH_MAX]; data/libaacs-0.9.0/src/file/mmc_device_linux.c:139: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(resolved_path, O_RDONLY | O_NONBLOCK); data/libaacs-0.9.0/src/file/mmc_device_linux.c:160:26: [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(mount_entry->mnt_fsname, O_RDONLY | O_NONBLOCK); data/libaacs-0.9.0/src/file/mmc_device_win32.c:111: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(sptd_sb.sptd.Cdb, cmd, 16); data/libaacs-0.9.0/src/file/path.c:34:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp_path[AACS_PATH_MAX]; data/libaacs-0.9.0/src/file/path.c:35: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 link[AACS_PATH_MAX]; data/libaacs-0.9.0/src/file/path.c:142: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 path[AACS_PATH_MAX]; data/libaacs-0.9.0/src/libaacs/aacs.c:57:21: [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). AACS_FILE_OPEN2 fopen; data/libaacs-0.9.0/src/libaacs/aacs.c:110: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[40]; data/libaacs-0.9.0/src/libaacs/aacs.c:179: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(data, version_rec, 12); data/libaacs-0.9.0/src/libaacs/aacs.c:180: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(data + 12, rl_rec, rl_len); data/libaacs-0.9.0/src/libaacs/aacs.c:229: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. unsigned char left_child[16], right_child[16]; data/libaacs-0.9.0/src/libaacs/aacs.c:244:13: [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(curr_key, left_child, 16); data/libaacs-0.9.0/src/libaacs/aacs.c:246:13: [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(curr_key, right_child, 16); data/libaacs-0.9.0/src/libaacs/aacs.c:254: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[40]; data/libaacs-0.9.0/src/libaacs/aacs.c:286: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[128]; data/libaacs-0.9.0/src/libaacs/aacs.c:302: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[128]; data/libaacs-0.9.0/src/libaacs/aacs.c:421: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 (aacs->fopen) { data/libaacs-0.9.0/src/libaacs/aacs.c:422:22: [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). return aacs->fopen(aacs->fopen_handle, file); data/libaacs-0.9.0/src/libaacs/aacs.c:539:17: [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[40]; data/libaacs-0.9.0/src/libaacs/aacs.c:608: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_str[2*92+1]; data/libaacs-0.9.0/src/libaacs/aacs.c:727: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[40]; data/libaacs-0.9.0/src/libaacs/aacs.c:742: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[48]; data/libaacs-0.9.0/src/libaacs/aacs.c:743: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 str2[48]; data/libaacs-0.9.0/src/libaacs/aacs.c:774: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(vuk, ce->entry.vuk, 16); data/libaacs-0.9.0/src/libaacs/aacs.c:935: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[40]; data/libaacs-0.9.0/src/libaacs/aacs.c:951: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[48]; data/libaacs-0.9.0/src/libaacs/aacs.c:1066: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(out_buf, in_buf, 16); /* first 16 bytes are plain */ data/libaacs-0.9.0/src/libaacs/aacs.c:1285: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(buf, out_buf, ALIGNED_UNIT_LEN); data/libaacs-0.9.0/src/libaacs/aacs.c:1339: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(aacs->mk, mk, 16); data/libaacs-0.9.0/src/libaacs/aacs.c:1516:13: [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, bcci, sizeof(*data)); data/libaacs-0.9.0/src/libaacs/cci.c:64: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(dst, src, bytes); data/libaacs-0.9.0/src/libaacs/content_cert.c:73: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(c->cc_id, p + 14, 6); data/libaacs-0.9.0/src/libaacs/content_cert.c:74: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(c->bdj_root_cert_hash, p + 46, 20); data/libaacs-0.9.0/src/libaacs/crypto.c:220: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(cmac, data, 16); data/libaacs-0.9.0/src/libaacs/crypto.c:234: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 errstr[100] = {0}; \ data/libaacs-0.9.0/src/libaacs/crypto.c:257: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. unsigned char Q[41]; data/libaacs-0.9.0/src/libaacs/crypto.c:258: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_Q[sizeof(Q) * 2 + 1]; data/libaacs-0.9.0/src/libaacs/crypto.c:269: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(&Q[0], "\x04", 1); // format data/libaacs-0.9.0/src/libaacs/crypto.c:270: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(&Q[1], q_x, 20); // Q.x data/libaacs-0.9.0/src/libaacs/crypto.c:271: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(&Q[21], q_y, 20); // Q.y data/libaacs-0.9.0/src/libaacs/crypto.c:446: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. unsigned char block[60]; data/libaacs-0.9.0/src/libaacs/crypto.c:455: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(&block[0], nonce, 20); data/libaacs-0.9.0/src/libaacs/crypto.c:456: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(&block[20], point, 40); data/libaacs-0.9.0/src/libaacs/crypto.c:649: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(bus_key, q_x_bin + n - 16, 16); data/libaacs-0.9.0/src/libaacs/mkb.c:263:17: [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[16]; data/libaacs-0.9.0/src/libaacs/mmc.c:85: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[512]; data/libaacs-0.9.0/src/libaacs/mmc.c:185:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + 4, host_nonce, 20); data/libaacs-0.9.0/src/libaacs/mmc.c:186:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + 24, host_cert, 92); data/libaacs-0.9.0/src/libaacs/mmc.c:198: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(drive_nonce, buf + 4, 20); data/libaacs-0.9.0/src/libaacs/mmc.c:199: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(drive_cert, buf + 24, 92); data/libaacs-0.9.0/src/libaacs/mmc.c:212: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(drive_key_point, buf + 4, 40); data/libaacs-0.9.0/src/libaacs/mmc.c:213: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(drive_key_signature, buf + 44, 40); data/libaacs-0.9.0/src/libaacs/mmc.c:267: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(mkb, buf + 4, len); data/libaacs-0.9.0/src/libaacs/mmc.c:275: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(mkb + *size, buf + 4, len); data/libaacs-0.9.0/src/libaacs/mmc.c:294:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + 4, host_key_point, 40); data/libaacs-0.9.0/src/libaacs/mmc.c:295:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + 44, host_key_signature, 40); data/libaacs-0.9.0/src/libaacs/mmc.c:307: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(volume_id, buf + 4, 16); data/libaacs-0.9.0/src/libaacs/mmc.c:308: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(mac, buf + 20, 16); data/libaacs-0.9.0/src/libaacs/mmc.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(pmsn, buf + 4, 16); data/libaacs-0.9.0/src/libaacs/mmc.c:323: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(mac, buf + 20, 16); data/libaacs-0.9.0/src/libaacs/mmc.c:335: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(read_data_key, buf + 4, 16); data/libaacs-0.9.0/src/libaacs/mmc.c:336: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(write_data_key, buf + 20, 16); data/libaacs-0.9.0/src/libaacs/mmc.c:363: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[sizeof(mmc->host_nonce)*2 + 1]; data/libaacs-0.9.0/src/libaacs/mmc.c:371: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[sizeof(mmc->host_key_point)*2 + 1]; data/libaacs-0.9.0/src/libaacs/mmc.c:422: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(data, nonce, 20); data/libaacs-0.9.0/src/libaacs/mmc.c:423: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(data + 20, point, 40); data/libaacs-0.9.0/src/libaacs/mmc.c:431: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[512]; data/libaacs-0.9.0/src/libaacs/mmc.c:522: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[512]; data/libaacs-0.9.0/src/libaacs/mmc.c:549: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[512]; data/libaacs-0.9.0/src/libaacs/mmc.c:577: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[512]; data/libaacs-0.9.0/src/libaacs/mmc.c:658: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(drive_cert, mmc->drive_cert, 92); data/libaacs-0.9.0/src/libaacs/mmc.c:678: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(mmc->drive_cert, buf + 4, 92); data/libaacs-0.9.0/src/libaacs/mmc.c:679: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(drive_cert, buf + 4, 92); data/libaacs-0.9.0/src/libaacs/unit_key.c:190: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(uk->enc_uk[i].key, p + uk_pos, 16); data/libaacs-0.9.0/src/util/logging.c:58:24: [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(env, "wb"); data/libaacs-0.9.0/src/util/logging.c:70: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 buffer[4096], *pt = buffer; data/libaacs-0.9.0/src/util/strutl.c:154: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(str + (i*2), "%02x", hex_array[i]); data/libaacs-0.9.0/src/util/strutl.c:168:13: [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(dup, str, size); data/libaacs-0.9.0/src/util/strutl.c:259: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(s, p, n); data/libaacs-0.9.0/src/util/strutl.c:270: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(out + (zz * 2), "%02x", buf[zz]); data/libaacs-0.9.0/src/file/dirs_xdg.c:100: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). dirs = calloc(1, strlen(xdg_sys) + 2); data/libaacs-0.9.0/src/file/dirs_xdg.c:121: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 += strlen(dir) + 1; data/libaacs-0.9.0/src/file/file.h:46:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return fp->read(fp, buf, size); data/libaacs-0.9.0/src/file/file_posix.c:75:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read((int)(intptr_t)file->internal, buf + got, size - got); data/libaacs-0.9.0/src/file/filesystem.h:33:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int64_t (*read)(AACS_FILE_H *file, uint8_t *buf, int64_t size); data/libaacs-0.9.0/src/file/mmc_device_darwin.c:178:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (mmc->bsd_name, basename (stat_info.f_mntfromname), sizeof (mmc->bsd_name)); data/libaacs-0.9.0/src/file/mmc_device_linux.c:126: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_len = strlen(resolved_path); data/libaacs-0.9.0/src/file/path.c:41: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). if (!path || !*path || strlen(path) >= AACS_PATH_MAX - 2) { data/libaacs-0.9.0/src/file/path.c:54: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). new_path += strlen(new_path); data/libaacs-0.9.0/src/util/strutl.c:165:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t size = strlen(str) + 1; ANALYSIS SUMMARY: Hits = 137 Lines analyzed = 8653 in approximately 0.42 seconds (20669 lines/second) Physical Source Lines of Code (SLOC) = 5618 Hits@level = [0] 56 [1] 10 [2] 103 [3] 14 [4] 9 [5] 1 Hits@level+ = [0+] 193 [1+] 137 [2+] 127 [3+] 24 [4+] 10 [5+] 1 Hits/KSLOC@level+ = [0+] 34.3539 [1+] 24.3859 [2+] 22.6059 [3+] 4.27198 [4+] 1.77999 [5+] 0.177999 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.