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/tcmu-1.5.2/alua.c Examining data/tcmu-1.5.2/alua.h Examining data/tcmu-1.5.2/api.c Examining data/tcmu-1.5.2/be_byteshift.h Examining data/tcmu-1.5.2/ccan/ccan/build_assert/build_assert.h Examining data/tcmu-1.5.2/ccan/ccan/check_type/check_type.h Examining data/tcmu-1.5.2/ccan/ccan/container_of/container_of.h Examining data/tcmu-1.5.2/ccan/ccan/list/list.h Examining data/tcmu-1.5.2/ccan/ccan/str/str.h Examining data/tcmu-1.5.2/ccan/ccan/str/str_debug.h Examining data/tcmu-1.5.2/configfs.c Examining data/tcmu-1.5.2/consumer.c Examining data/tcmu-1.5.2/darray.h Examining data/tcmu-1.5.2/file_example.c Examining data/tcmu-1.5.2/file_optical.c Examining data/tcmu-1.5.2/file_zbc.c Examining data/tcmu-1.5.2/glfs.c Examining data/tcmu-1.5.2/libtcmu-register.c Examining data/tcmu-1.5.2/libtcmu.c Examining data/tcmu-1.5.2/libtcmu.h Examining data/tcmu-1.5.2/libtcmu_common.h Examining data/tcmu-1.5.2/libtcmu_config.c Examining data/tcmu-1.5.2/libtcmu_config.h Examining data/tcmu-1.5.2/libtcmu_log.c Examining data/tcmu-1.5.2/libtcmu_log.h Examining data/tcmu-1.5.2/libtcmu_priv.h Examining data/tcmu-1.5.2/libtcmu_time.c Examining data/tcmu-1.5.2/libtcmu_time.h Examining data/tcmu-1.5.2/main.c Examining data/tcmu-1.5.2/qcow.c Examining data/tcmu-1.5.2/qcow.h Examining data/tcmu-1.5.2/qcow2.h Examining data/tcmu-1.5.2/rbd.c Examining data/tcmu-1.5.2/scsi.c Examining data/tcmu-1.5.2/scsi.h Examining data/tcmu-1.5.2/scsi_defs.h Examining data/tcmu-1.5.2/string_priv.h Examining data/tcmu-1.5.2/strlcpy.c Examining data/tcmu-1.5.2/target.c Examining data/tcmu-1.5.2/target.h Examining data/tcmu-1.5.2/target_core_user_local.h Examining data/tcmu-1.5.2/tcmu-runner.h Examining data/tcmu-1.5.2/tcmu-synthesizer.c Examining data/tcmu-1.5.2/tcmu_runner_priv.h Examining data/tcmu-1.5.2/tcmur_aio.c Examining data/tcmu-1.5.2/tcmur_aio.h Examining data/tcmu-1.5.2/tcmur_cmd_handler.h Examining data/tcmu-1.5.2/tcmur_device.c Examining data/tcmu-1.5.2/tcmur_device.h Examining data/tcmu-1.5.2/tcmur_cmd_handler.c FINAL RESULTS: data/tcmu-1.5.2/qcow.c:135:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. len = readlink(proc_path, img_path, PATH_MAX); data/tcmu-1.5.2/alua.c:36:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/alua/%s/%s", data/tcmu-1.5.2/alua.c:47:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/alua/%s/%s", data/tcmu-1.5.2/alua.c:58:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/alua/%s/%s", data/tcmu-1.5.2/alua.c:305:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/alua", data/tcmu-1.5.2/api.c:346:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. n += sprintf(buf + n, "%s", info); data/tcmu-1.5.2/configfs.c:64:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/attrib/%s", data/tcmu-1.5.2/configfs.c:81:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/info", data/tcmu-1.5.2/configfs.c:143:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/control", data/tcmu-1.5.2/configfs.c:154:2: [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(path, sizeof(path), CFGFS_MOD_PARAM"/%s", name); data/tcmu-1.5.2/configfs.c:171:2: [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(path, sizeof(path), data/tcmu-1.5.2/configfs.c:327:2: [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(path, sizeof(path), CFGFS_CORE"/%s/%s/action/%s", data/tcmu-1.5.2/file_optical.c:155: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(path, F_OK) == -1) data/tcmu-1.5.2/libtcmu_log.c:234:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/tcmu-1.5.2/libtcmu_log.c:241:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. n = sprintf(buf, "%s:%d %s/%s: ", funcname, linenr, data/tcmu-1.5.2/libtcmu_log.c:245:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. n = sprintf(buf, "%s:%d: ", funcname, linenr); data/tcmu-1.5.2/libtcmu_log.c:248:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buf + n, LOG_MSG_LEN - n, fmt, args); data/tcmu-1.5.2/libtcmu_log.h:37:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/libtcmu_log.h:39:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/libtcmu_log.h:41:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/libtcmu_log.h:43:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/libtcmu_log.h:45:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/libtcmu_log.h:47:25: [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. __attribute__ ((format (printf, 4, 5))) data/tcmu-1.5.2/target.c:53:2: [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(path, sizeof(path), CFGFS_ROOT"/%s/%s/tpgt_%hu/%s", data/tcmu-1.5.2/target.c:62:2: [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(path, sizeof(path), data/tcmu-1.5.2/target.c:73:2: [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(path, sizeof(path), data/tcmu-1.5.2/target.c:99:8: [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. ret = sscanf(member_str, "%16[^/]/%223[^/]/tpgt_%hu/lun_%"PRIu64, data/tcmu-1.5.2/libtcmu_config.c:483:12: [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. log_dir = getenv("TCMU_LOGDIR"); data/tcmu-1.5.2/main.c:1214:7: [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. c = getopt_long(argc, argv, "df:hl:V", data/tcmu-1.5.2/tcmu-synthesizer.c:176:7: [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. c = getopt_long(argc, argv, "dhV", data/tcmu-1.5.2/alua.c:34: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/tcmu-1.5.2/alua.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 path[PATH_MAX]; data/tcmu-1.5.2/alua.c:56: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/tcmu-1.5.2/alua.c:301: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/tcmu-1.5.2/alua.c:529: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(&buf[0], &ret32, 4); data/tcmu-1.5.2/api.c:272: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(iovec->iov_base, src + copied, to_copy); data/tcmu-1.5.2/api.c:302: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(dest + copied, iovec->iov_base, to_copy); data/tcmu-1.5.2/api.c:325: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 fix[CDB_FIX_SIZE], *buf; data/tcmu-1.5.2/api.c:342:8: [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. n += sprintf(buf + n, "%x ", cmd->cdb[i]); data/tcmu-1.5.2/configfs.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[16]; data/tcmu-1.5.2/configfs.c:31: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/tcmu-1.5.2/configfs.c:62: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/tcmu-1.5.2/configfs.c:73: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/tcmu-1.5.2/configfs.c:74: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[CFGFS_BUF_SIZE]; data/tcmu-1.5.2/configfs.c:84: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/tcmu-1.5.2/configfs.c:140: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/tcmu-1.5.2/configfs.c:141: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[CFGFS_BUF_SIZE]; data/tcmu-1.5.2/configfs.c:152: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/tcmu-1.5.2/configfs.c:166: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/tcmu-1.5.2/configfs.c:167: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[CFGFS_BUF_SIZE]; data/tcmu-1.5.2/configfs.c:175: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/tcmu-1.5.2/configfs.c:215: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[CFGFS_BUF_SIZE]; data/tcmu-1.5.2/configfs.c:220: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/tcmu-1.5.2/configfs.c:290: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_WRONLY); data/tcmu-1.5.2/configfs.c:315: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[20]; data/tcmu-1.5.2/configfs.c:317:2: [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(buf, "%"PRIu32"", val); data/tcmu-1.5.2/configfs.c:324: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/tcmu-1.5.2/darray.h:181: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((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \ data/tcmu-1.5.2/darray.h:188: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((arr).item, items, __count * sizeof(*(arr).item)); \ data/tcmu-1.5.2/darray.h:194: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((arr).item + __oldSize, items, __count * sizeof(*(arr).item)); \ data/tcmu-1.5.2/darray.h:202: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((arr).item, items, __count * sizeof(*(arr).item)); \ data/tcmu-1.5.2/darray.h:230:105: [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 darray_from_items(arr, items, count) do {size_t __count = (count); darray_resize(arr, __count); memcpy((arr).item, items, __count*sizeof(*(arr).item));} while(0) data/tcmu-1.5.2/file_example.c:64: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). state->fd = open(config, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); data/tcmu-1.5.2/file_optical.c:156: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). state->fd = open(path, O_CREAT | O_RDWR | O_EXCL, data/tcmu-1.5.2/file_optical.c:159: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). state->fd = open(path, O_RDONLY, 0); data/tcmu-1.5.2/file_optical.c:161: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). state->fd = open(path, O_RDWR, 0); data/tcmu-1.5.2/file_optical.c:205: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(&buf[8], "LIO-ORG ", 8); data/tcmu-1.5.2/file_optical.c:207: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(&buf[16], "VOPTA", 5); data/tcmu-1.5.2/file_optical.c:208: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(&buf[32], "0001", 4); data/tcmu-1.5.2/file_optical.c:923: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(&buf[4], manuf_info, strlen(manuf_info)); data/tcmu-1.5.2/file_optical.c:1423: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(&buf[12], &buf[4], 8); data/tcmu-1.5.2/file_zbc.c:797: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). zdev->fd = open(cfg->path, O_CREAT | O_RDWR | O_LARGEFILE, data/tcmu-1.5.2/file_zbc.c:976: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(&ptr[4], "LIO-ORG ", 8); data/tcmu-1.5.2/file_zbc.c:1022: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(&data[2], &val16, 2); data/tcmu-1.5.2/file_zbc.c:1034: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(&data[2], &val16, 2); data/tcmu-1.5.2/file_zbc.c:1069: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(&data[8], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1072: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(&data[12], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1076: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(&data[36], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1087: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(&data[2], &val16, 2); data/tcmu-1.5.2/file_zbc.c:1091: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(&data[4], &val16, 2); data/tcmu-1.5.2/file_zbc.c:1105: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(&data[2], &val16, 2); data/tcmu-1.5.2/file_zbc.c:1117: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(&data[8], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1123: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(&data[12], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1131: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(&data[16], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1162: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(&buf[8], "LIO-ORG ", 8); data/tcmu-1.5.2/file_zbc.c:1163: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(&buf[16], "TCMU ZBC device", 15); data/tcmu-1.5.2/file_zbc.c:1164: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(&buf[32], "0002", 4); data/tcmu-1.5.2/file_zbc.c:1320: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[0], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1322: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[8], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1343: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(&data[8], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1345: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(&data[16], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1347: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(&data[24], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1711: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[0], &val64, 8); data/tcmu-1.5.2/file_zbc.c:1715: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[8], &val32, 4); data/tcmu-1.5.2/file_zbc.c:1869: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(&data[0], &val16, 2); data/tcmu-1.5.2/glfs.c:200: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 logfilepath[PATH_MAX]; data/tcmu-1.5.2/glfs.c:425: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 logfilepath[PATH_MAX]; data/tcmu-1.5.2/glfs.c:450:5: [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(entry->server->u.inet.port)); data/tcmu-1.5.2/libtcmu.c:200: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[32]; data/tcmu-1.5.2/libtcmu.c:401: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_buf[256]; data/tcmu-1.5.2/libtcmu.c:495: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). dev->fd = open(str_buf, O_RDWR | O_NONBLOCK | O_CLOEXEC); data/tcmu-1.5.2/libtcmu.c:502: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(str_buf, O_RDONLY); data/tcmu-1.5.2/libtcmu.c:622: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] = {'\0'}; data/tcmu-1.5.2/libtcmu.c:627: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(tmp_path, O_RDONLY); data/tcmu-1.5.2/libtcmu.c:1004: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(cmd->cdb, (void *) mb + ent->req.cdb_off, cdb_len); data/tcmu-1.5.2/libtcmu.c:1171: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(ent->rsp.sense_buffer, cmd->sense_buf, data/tcmu-1.5.2/libtcmu_config.c:302:21: [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). option->opt_int = atoi(s); data/tcmu-1.5.2/libtcmu_config.c:365: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). if ((fd = open(TCMU_CONFIG_FILE_DEFAULT, O_RDONLY)) == -1) { data/tcmu-1.5.2/libtcmu_config.c:401: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[BUF_LEN]; data/tcmu-1.5.2/libtcmu_config.h:23: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 log_dir[PATH_MAX]; data/tcmu-1.5.2/libtcmu_config.h:24: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 def_log_dir[PATH_MAX]; data/tcmu-1.5.2/libtcmu_log.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 buf[LOG_ENTRYS][LOG_ENTRY_LEN]; data/tcmu-1.5.2/libtcmu_log.c:184: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 timestamp[TCMU_TIME_STRING_BUFLEN] = {0, }; data/tcmu-1.5.2/libtcmu_log.c:202: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(msg, buf, LOG_MSG_LEN); data/tcmu-1.5.2/libtcmu_log.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[LOG_MSG_LEN]; data/tcmu-1.5.2/libtcmu_log.c:444: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 log_file_path[PATH_MAX]; data/tcmu-1.5.2/libtcmu_log.c:456: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(log_file_path, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR); data/tcmu-1.5.2/libtcmu_log.c:489: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 *msg, buf[LOG_MSG_LEN]; data/tcmu-1.5.2/libtcmu_log.c:501: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(buf, msg, LOG_MSG_LEN); data/tcmu-1.5.2/libtcmu_log.c:587: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], *ch; data/tcmu-1.5.2/libtcmu_priv.h:59: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 dev_name[16]; /* e.g. "uio14" */ data/tcmu-1.5.2/libtcmu_priv.h:60: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 tcm_hba_name[16]; /* e.g. "user_8" */ data/tcmu-1.5.2/libtcmu_priv.h:61: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 tcm_dev_name[128]; /* e.g. "backup2" */ data/tcmu-1.5.2/libtcmu_priv.h:62: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 cfgstring[PATH_MAX]; data/tcmu-1.5.2/main.c:250: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 obj_name[128]; data/tcmu-1.5.2/main.c:270: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 obj_name[128]; data/tcmu-1.5.2/main.c:902:25: [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). rdev->cmd_time_out = atoi(arg + 19); data/tcmu-1.5.2/main.c:1019:18: [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). ret = rhandler->open(dev, false); data/tcmu-1.5.2/main.c:1230:15: [2] (integer) atol: 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). nr_files = atol(optarg); data/tcmu-1.5.2/qcow.c:91: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). int (*open) (struct bdev *dev, int dirfd, const char *pathname, int flags); data/tcmu-1.5.2/qcow.c:109:16: [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 ((*ops)->open(bdev, dirfd, pathname, flags) == -1) { data/tcmu-1.5.2/qcow.c:124: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 proc_path[64]; data/tcmu-1.5.2/qcow.c:139: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). dirfd = open(dir, O_DIRECTORY | O_PATH); data/tcmu-1.5.2/qcow2.h:220: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 name[46]; data/tcmu-1.5.2/rbd.c:244: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 *mon_cmd_bufs[2] = {NULL, NULL}; data/tcmu-1.5.2/rbd.c:284: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 *mon_cmd_bufs[2] = {NULL, NULL}; data/tcmu-1.5.2/rbd.c:362: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[128]; data/tcmu-1.5.2/rbd.c:372: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). grace = atoi(buf); data/tcmu-1.5.2/rbd.c:380: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). interval = atoi(buf); data/tcmu-1.5.2/rbd.c:410:8: [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. len = sprintf(buf, "%d", grace + interval + 5); data/tcmu-1.5.2/rbd.c:557: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 *owners[1]; data/tcmu-1.5.2/rbd.c:610: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 *metadata_owner, *owners[1]; data/tcmu-1.5.2/rbd.c:613:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[TCMU_RBD_LOCKER_BUF_LEN]; data/tcmu-1.5.2/rbd.c:678: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 *owners[1]; data/tcmu-1.5.2/scsi.c:56: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(&buf[8], "LIO-ORG ", 8); data/tcmu-1.5.2/scsi.c:58: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(&buf[16], "TCMU device", 11); data/tcmu-1.5.2/scsi.c:59: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(&buf[32], "0002", 4); data/tcmu-1.5.2/scsi.c:94: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 data[16]; data/tcmu-1.5.2/scsi.c:119: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 data[512]; data/tcmu-1.5.2/scsi.c:147: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 data[512]; data/tcmu-1.5.2/scsi.c:168: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(&ptr[4], "LIO-ORG ", 8); data/tcmu-1.5.2/scsi.c:318: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 data[64]; data/tcmu-1.5.2/scsi.c:330: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(&data[2], &val16, 2); data/tcmu-1.5.2/scsi.c:359: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(&data[8], &val32, 4); data/tcmu-1.5.2/scsi.c:361: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(&data[12], &val32, 4); data/tcmu-1.5.2/scsi.c:366: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(&data[20], &val32, 4); data/tcmu-1.5.2/scsi.c:370: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(&data[24], &val32, 4); data/tcmu-1.5.2/scsi.c:374: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(&data[28], &val32, 4); data/tcmu-1.5.2/scsi.c:379: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(&data[32], &val32, 4); data/tcmu-1.5.2/scsi.c:387: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(&data[36], &val64, 8); data/tcmu-1.5.2/scsi.c:396: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 data[64]; data/tcmu-1.5.2/scsi.c:412: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(&data[2], &val16, 2); data/tcmu-1.5.2/scsi.c:416: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(&data[4], &val16, 2); data/tcmu-1.5.2/scsi.c:425: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 data[64]; data/tcmu-1.5.2/scsi.c:444: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(&data[2], &val16, 2); data/tcmu-1.5.2/scsi.c:523: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(&buf[0], &val32, 4); data/tcmu-1.5.2/scsi.c:526: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(&buf[4], &val32, 4); data/tcmu-1.5.2/scsi.c:550: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(&buf[0], &val64, 8); data/tcmu-1.5.2/scsi.c:553: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(&buf[8], &val32, 4); data/tcmu-1.5.2/scsi.c:591: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(to_buf, from_buf, to_len > from_len ? from_len : to_len); data/tcmu-1.5.2/target.c:51: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/tcmu-1.5.2/target.c:60: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/tcmu-1.5.2/target.c:71: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/tcmu-1.5.2/target.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 fabric[17], wwn[224]; data/tcmu-1.5.2/target_core_user_local.h:121:4: [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 sense_buffer[TCMU_SENSE_BUFFERSIZE]; data/tcmu-1.5.2/tcmu-runner.h:88: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). int (*open)(struct tcmu_device *dev, bool reopen); data/tcmu-1.5.2/tcmur_cmd_handler.c:738: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(tcmur_cmd->iovec->iov_base + i * block_size, data/tcmu-1.5.2/tcmur_cmd_handler.c:1136: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(&xcopy->src_tid_wwn[0], &tgt_desc[8], data/tcmu-1.5.2/tcmur_cmd_handler.c:1147: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(xcopy->dst_tid_wwn, &tgt_desc[8], data/tcmu-1.5.2/tcmur_cmd_handler.c:1542: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(xcopy, &xcopy_parse, sizeof(*xcopy)); data/tcmu-1.5.2/tcmur_cmd_handler.c:1790: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(&buf[8], &val16, 2); data/tcmu-1.5.2/tcmur_cmd_handler.c:1798: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(&buf[10], &val16, 2); data/tcmu-1.5.2/tcmur_cmd_handler.c:1805: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(&buf[12], &val32, 4); data/tcmu-1.5.2/tcmur_cmd_handler.c:1813: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(&buf[16], &val32, 4); data/tcmu-1.5.2/tcmur_cmd_handler.c:1821: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(&buf[34], &val16, 2); data/tcmu-1.5.2/tcmur_cmd_handler.c:1870: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(&buf[0], &val32, 4); data/tcmu-1.5.2/tcmur_device.c:109:19: [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). ret = rhandler->open(dev, true); data/tcmu-1.5.2/alua.c:238:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!strlen(member)) data/tcmu-1.5.2/api.c:348:2: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf + n, "\n"); data/tcmu-1.5.2/ccan/ccan/str/str.h:32: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). #define strstarts(str,prefix) (strncmp((str),(prefix),strlen(prefix)) == 0) data/tcmu-1.5.2/ccan/ccan/str/str.h: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). if (strlen(str) < strlen(postfix)) data/tcmu-1.5.2/ccan/ccan/str/str.h:45: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). if (strlen(str) < strlen(postfix)) data/tcmu-1.5.2/ccan/ccan/str/str.h:48: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). return streq(str + strlen(str) - strlen(postfix), postfix); data/tcmu-1.5.2/ccan/ccan/str/str.h:48: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). return streq(str + strlen(str) - strlen(postfix), postfix); data/tcmu-1.5.2/configfs.c:43:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/tcmu-1.5.2/configfs.c:97:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/tcmu-1.5.2/configfs.c:125: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). rover += strlen(name) + 3; /* name plus ':' and spaces before/after */ data/tcmu-1.5.2/configfs.c:147:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return tcmu_cfgfs_set_str(path, buf, strlen(buf) + 1); data/tcmu-1.5.2/configfs.c:187:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/tcmu-1.5.2/configfs.c:232:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/tcmu-1.5.2/configfs.c:248: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). if (ret != strlen(buf)) { data/tcmu-1.5.2/configfs.c:250: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). n = strlen(buf); data/tcmu-1.5.2/configfs.c:318:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return tcmu_cfgfs_set_str(path, buf, strlen(buf) + 1); data/tcmu-1.5.2/darray.h:236:103: [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 darray_append_string(arr, str) do {const char *__str = (str); darray_append_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0) data/tcmu-1.5.2/darray.h:241:50: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). darray_prepend_items_nullterminate(arr, __str, strlen(__str)); \ data/tcmu-1.5.2/darray.h:246:99: [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 darray_from_string(arr, str) do {const char *__str = (str); darray_from_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0) data/tcmu-1.5.2/file_optical.c:922: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). buf[2] = strlen(manuf_info) + 2; // DVD Struct Data Len data/tcmu-1.5.2/file_optical.c:923: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). memcpy(&buf[4], manuf_info, strlen(manuf_info)); data/tcmu-1.5.2/file_optical.c:926: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). strlen(manuf_info) + 4); data/tcmu-1.5.2/file_optical.c:952: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). buf[15] = strlen(manuf_info) + 4; // Structure Length data/tcmu-1.5.2/file_zbc.c:402: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). strlen(zbc_params[i].name)) == 0) data/tcmu-1.5.2/file_zbc.c:410: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). str += strlen(zbc_params[i].name); data/tcmu-1.5.2/glfs.c:401: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). if (!strlen(entry->server->u.uds.socket) || data/tcmu-1.5.2/glfs.c:402:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). !strlen(entry->volname) || !strlen(entry->path)) data/tcmu-1.5.2/glfs.c:402: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). !strlen(entry->volname) || !strlen(entry->path)) data/tcmu-1.5.2/glfs.c:405: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). if (!strlen(entry->server->u.inet.addr) || data/tcmu-1.5.2/glfs.c:406:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). !strlen(entry->volname) || !strlen(entry->path)) data/tcmu-1.5.2/glfs.c:406: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). !strlen(entry->volname) || !strlen(entry->path)) data/tcmu-1.5.2/libtcmu.c:387:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(50000); data/tcmu-1.5.2/libtcmu.c:508:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, str_buf, sizeof(str_buf)); data/tcmu-1.5.2/libtcmu.c:633:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/tcmu-1.5.2/libtcmu.c:1186:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(dev->fd, &buf, 4); data/tcmu-1.5.2/libtcmu_config.c:204:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fd, buf, count); data/tcmu-1.5.2/libtcmu_config.c:432:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(monitor, buf, BUF_LEN); data/tcmu-1.5.2/libtcmu_log.c:351: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). return strlen(str); data/tcmu-1.5.2/libtcmu_log.c:421: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). count = strlen(buf); data/tcmu-1.5.2/libtcmu_log.c:541: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(path) >= PATH_MAX - TCMU_LOG_FILENAME_MAX) { data/tcmu-1.5.2/main.c:895: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). cfg_end = cfg_str + strlen(cfg_str) + 1; data/tcmu-1.5.2/qcow.c:443:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/tcmu-1.5.2/qcow.c:511:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != s->l1_size * sizeof(uint64_t)) { data/tcmu-1.5.2/qcow.c:559:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/tcmu-1.5.2/qcow.c:632:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != s->l1_size * sizeof(uint64_t)) { data/tcmu-1.5.2/qcow.c:664:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != s->refcount_table_size * sizeof(uint64_t)) { data/tcmu-1.5.2/qcow.c:725:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/tcmu-1.5.2/qcow.c:749:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != s->l2_size * sizeof(uint64_t)) data/tcmu-1.5.2/qcow.c:869:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/tcmu-1.5.2/qcow.c:892:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != 1 << s->cluster_bits) data/tcmu-1.5.2/qcow.c:1216:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/tcmu-1.5.2/qcow.c:1246:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != n * 512) data/tcmu-1.5.2/qcow.c:1260:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read != n * 512) data/tcmu-1.5.2/rbd.c:99:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } read; data/tcmu-1.5.2/rbd.c:900: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(state->osd_op_timeout)) { data/tcmu-1.5.2/rbd.c:907: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 (!state->conf_path || !strlen(state->conf_path)) { data/tcmu-1.5.2/rbd.c:914: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). if (!state->id || !strlen(state->id)) { data/tcmu-1.5.2/rbd.c:1117:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). aio_cb->read.length); data/tcmu-1.5.2/rbd.c:1144:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). aio_cb->read.length = length; data/tcmu-1.5.2/target.c:96: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(member_str)) data/tcmu-1.5.2/tcmu-runner.h:141:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int (*read)(struct tcmu_device *dev, struct tcmur_cmd *cmd, data/tcmu-1.5.2/tcmur_cmd_handler.c:187:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return rhandler->read(dev, tcmur_cmd, cmd->iovec, cmd->iov_cnt, data/tcmu-1.5.2/tcmur_cmd_handler.c:834:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return rhandler->read(dev, tcmur_cmd, tcmur_cmd->iovec, data/tcmu-1.5.2/tcmur_cmd_handler.c:1477:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return rhandler->read(src_dev, tcmur_cmd, tcmur_cmd->iovec, data/tcmu-1.5.2/tcmur_cmd_handler.c:1579:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return rhandler->read(dev, tcmur_cmd, tcmur_cmd->iovec, data/tcmu-1.5.2/tcmur_cmd_handler.c:2077:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (rhandler->write || rhandler->read || rhandler->flush) ANALYSIS SUMMARY: Hits = 253 Lines analyzed = 22321 in approximately 0.50 seconds (44379 lines/second) Physical Source Lines of Code (SLOC) = 15288 Hits@level = [0] 48 [1] 66 [2] 157 [3] 3 [4] 26 [5] 1 Hits@level+ = [0+] 301 [1+] 253 [2+] 187 [3+] 30 [4+] 27 [5+] 1 Hits/KSLOC@level+ = [0+] 19.6886 [1+] 16.5489 [2+] 12.2318 [3+] 1.96232 [4+] 1.76609 [5+] 0.0654108 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.