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/raft-0.9.25/benchmark/os_disk_write.c Examining data/raft-0.9.25/example/cluster.c Examining data/raft-0.9.25/example/server.c Examining data/raft-0.9.25/include/raft.h Examining data/raft-0.9.25/include/raft/fixture.h Examining data/raft-0.9.25/include/raft/uv.h Examining data/raft-0.9.25/src/array.h Examining data/raft-0.9.25/src/assert.h Examining data/raft-0.9.25/src/byte.c Examining data/raft-0.9.25/src/byte.h Examining data/raft-0.9.25/src/client.c Examining data/raft-0.9.25/src/configuration.c Examining data/raft-0.9.25/src/configuration.h Examining data/raft-0.9.25/src/convert.c Examining data/raft-0.9.25/src/convert.h Examining data/raft-0.9.25/src/election.c Examining data/raft-0.9.25/src/election.h Examining data/raft-0.9.25/src/entry.c Examining data/raft-0.9.25/src/entry.h Examining data/raft-0.9.25/src/err.c Examining data/raft-0.9.25/src/err.h Examining data/raft-0.9.25/src/fixture.c Examining data/raft-0.9.25/src/heap.c Examining data/raft-0.9.25/src/heap.h Examining data/raft-0.9.25/src/log.c Examining data/raft-0.9.25/src/log.h Examining data/raft-0.9.25/src/membership.c Examining data/raft-0.9.25/src/membership.h Examining data/raft-0.9.25/src/progress.c Examining data/raft-0.9.25/src/progress.h Examining data/raft-0.9.25/src/queue.h Examining data/raft-0.9.25/src/raft.c Examining data/raft-0.9.25/src/recv.c Examining data/raft-0.9.25/src/recv.h Examining data/raft-0.9.25/src/recv_append_entries.c Examining data/raft-0.9.25/src/recv_append_entries.h Examining data/raft-0.9.25/src/recv_append_entries_result.c Examining data/raft-0.9.25/src/recv_append_entries_result.h Examining data/raft-0.9.25/src/recv_install_snapshot.c Examining data/raft-0.9.25/src/recv_install_snapshot.h Examining data/raft-0.9.25/src/recv_request_vote.c Examining data/raft-0.9.25/src/recv_request_vote.h Examining data/raft-0.9.25/src/recv_request_vote_result.c Examining data/raft-0.9.25/src/recv_request_vote_result.h Examining data/raft-0.9.25/src/recv_timeout_now.c Examining data/raft-0.9.25/src/recv_timeout_now.h Examining data/raft-0.9.25/src/replication.c Examining data/raft-0.9.25/src/replication.h Examining data/raft-0.9.25/src/request.h Examining data/raft-0.9.25/src/snapshot.c Examining data/raft-0.9.25/src/snapshot.h Examining data/raft-0.9.25/src/start.c Examining data/raft-0.9.25/src/state.c Examining data/raft-0.9.25/src/syscall.c Examining data/raft-0.9.25/src/syscall.h Examining data/raft-0.9.25/src/tick.c Examining data/raft-0.9.25/src/tick.h Examining data/raft-0.9.25/src/tracing.c Examining data/raft-0.9.25/src/tracing.h Examining data/raft-0.9.25/src/uv.c Examining data/raft-0.9.25/src/uv.h Examining data/raft-0.9.25/src/uv_append.c Examining data/raft-0.9.25/src/uv_encoding.c Examining data/raft-0.9.25/src/uv_encoding.h Examining data/raft-0.9.25/src/uv_finalize.c Examining data/raft-0.9.25/src/uv_fs.c Examining data/raft-0.9.25/src/uv_fs.h Examining data/raft-0.9.25/src/uv_ip.c Examining data/raft-0.9.25/src/uv_ip.h Examining data/raft-0.9.25/src/uv_list.c Examining data/raft-0.9.25/src/uv_metadata.c Examining data/raft-0.9.25/src/uv_os.c Examining data/raft-0.9.25/src/uv_os.h Examining data/raft-0.9.25/src/uv_prepare.c Examining data/raft-0.9.25/src/uv_recv.c Examining data/raft-0.9.25/src/uv_segment.c Examining data/raft-0.9.25/src/uv_send.c Examining data/raft-0.9.25/src/uv_snapshot.c Examining data/raft-0.9.25/src/uv_tcp.c Examining data/raft-0.9.25/src/uv_tcp.h Examining data/raft-0.9.25/src/uv_tcp_connect.c Examining data/raft-0.9.25/src/uv_tcp_listen.c Examining data/raft-0.9.25/src/uv_truncate.c Examining data/raft-0.9.25/src/uv_writer.c Examining data/raft-0.9.25/src/uv_writer.h Examining data/raft-0.9.25/test/fuzzy/main_core.c Examining data/raft-0.9.25/test/fuzzy/test_election.c Examining data/raft-0.9.25/test/fuzzy/test_liveness.c Examining data/raft-0.9.25/test/fuzzy/test_membership.c Examining data/raft-0.9.25/test/fuzzy/test_replication.c Examining data/raft-0.9.25/test/integration/main_core.c Examining data/raft-0.9.25/test/integration/main_uv.c Examining data/raft-0.9.25/test/integration/test_apply.c Examining data/raft-0.9.25/test/integration/test_assign.c Examining data/raft-0.9.25/test/integration/test_barrier.c Examining data/raft-0.9.25/test/integration/test_bootstrap.c Examining data/raft-0.9.25/test/integration/test_digest.c Examining data/raft-0.9.25/test/integration/test_election.c Examining data/raft-0.9.25/test/integration/test_fixture.c Examining data/raft-0.9.25/test/integration/test_heap.c Examining data/raft-0.9.25/test/integration/test_membership.c Examining data/raft-0.9.25/test/integration/test_recover.c Examining data/raft-0.9.25/test/integration/test_replication.c Examining data/raft-0.9.25/test/integration/test_snapshot.c Examining data/raft-0.9.25/test/integration/test_start.c Examining data/raft-0.9.25/test/integration/test_strerror.c Examining data/raft-0.9.25/test/integration/test_tick.c Examining data/raft-0.9.25/test/integration/test_transfer.c Examining data/raft-0.9.25/test/integration/test_uv_append.c Examining data/raft-0.9.25/test/integration/test_uv_bootstrap.c Examining data/raft-0.9.25/test/integration/test_uv_init.c Examining data/raft-0.9.25/test/integration/test_uv_load.c Examining data/raft-0.9.25/test/integration/test_uv_recover.c Examining data/raft-0.9.25/test/integration/test_uv_recv.c Examining data/raft-0.9.25/test/integration/test_uv_send.c Examining data/raft-0.9.25/test/integration/test_uv_set_term.c Examining data/raft-0.9.25/test/integration/test_uv_snapshot_put.c Examining data/raft-0.9.25/test/integration/test_uv_tcp_connect.c Examining data/raft-0.9.25/test/integration/test_uv_tcp_listen.c Examining data/raft-0.9.25/test/integration/test_uv_truncate.c Examining data/raft-0.9.25/test/lib/aio.c Examining data/raft-0.9.25/test/lib/aio.h Examining data/raft-0.9.25/test/lib/cluster.c Examining data/raft-0.9.25/test/lib/cluster.h Examining data/raft-0.9.25/test/lib/dir.c Examining data/raft-0.9.25/test/lib/dir.h Examining data/raft-0.9.25/test/lib/fault.c Examining data/raft-0.9.25/test/lib/fault.h Examining data/raft-0.9.25/test/lib/fsm.c Examining data/raft-0.9.25/test/lib/fsm.h Examining data/raft-0.9.25/test/lib/heap.c Examining data/raft-0.9.25/test/lib/heap.h Examining data/raft-0.9.25/test/lib/loop.c Examining data/raft-0.9.25/test/lib/loop.h Examining data/raft-0.9.25/test/lib/macros.h Examining data/raft-0.9.25/test/lib/munit.c Examining data/raft-0.9.25/test/lib/munit.h Examining data/raft-0.9.25/test/lib/runner.h Examining data/raft-0.9.25/test/lib/snapshot.h Examining data/raft-0.9.25/test/lib/tcp.c Examining data/raft-0.9.25/test/lib/tcp.h Examining data/raft-0.9.25/test/lib/tracer.c Examining data/raft-0.9.25/test/lib/tracer.h Examining data/raft-0.9.25/test/lib/uv.h Examining data/raft-0.9.25/test/unit/main_core.c Examining data/raft-0.9.25/test/unit/main_uv.c Examining data/raft-0.9.25/test/unit/test_byte.c Examining data/raft-0.9.25/test/unit/test_configuration.c Examining data/raft-0.9.25/test/unit/test_err.c Examining data/raft-0.9.25/test/unit/test_log.c Examining data/raft-0.9.25/test/unit/test_queue.c Examining data/raft-0.9.25/test/unit/test_uv_fs.c Examining data/raft-0.9.25/test/unit/test_uv_writer.c FINAL RESULTS: data/raft-0.9.25/test/lib/dir.c:125:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. rv = chmod(dir, 0755); data/raft-0.9.25/test/lib/dir.c:336:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. rv = chmod(dir, 0); data/raft-0.9.25/test/lib/dir.c:344:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. rv = chmod(dir, 0500); data/raft-0.9.25/test/lib/dir.c:355:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. rv = chmod(path, 0); data/raft-0.9.25/benchmark/os_disk_write.c:120:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/bench-XXXXXX", dir); data/raft-0.9.25/example/cluster.c:46:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(dir, "%s/%u", topLevelDir, i + 1); data/raft-0.9.25/src/byte.h:110: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(*p, value); data/raft-0.9.25/src/configuration.c:152: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(server->address, address); data/raft-0.9.25/src/err.h:31:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(ERRMSG, RAFT_ERRMSG_BUF_SIZE, __VA_ARGS__) data/raft-0.9.25/src/raft.c:45: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(r->address, address); data/raft-0.9.25/src/recv.c:215: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(r->follower_state.current_leader.address, address); data/raft-0.9.25/src/tracing.h:15:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(_msg, sizeof _msg, __VA_ARGS__); \ data/raft-0.9.25/src/uv.c:579: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(uv->dir, dir); data/raft-0.9.25/src/uv_finalize.c:39:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename1, UV__OPEN_TEMPLATE, segment->counter); data/raft-0.9.25/src/uv_finalize.c:40:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename2, UV__CLOSED_TEMPLATE, segment->first_index, data/raft-0.9.25/src/uv_ip.c:19: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(buf, address); data/raft-0.9.25/src/uv_metadata.c:51:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, METADATA_FILENAME_PREFIX "%d", n); data/raft-0.9.25/src/uv_os.c:149: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(path, dir); data/raft-0.9.25/src/uv_os.c:151:5: [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(path, filename); data/raft-0.9.25/src/uv_prepare.c:166:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(segment->filename, UV__OPEN_TEMPLATE, segment->counter); data/raft-0.9.25/src/uv_prepare.c:272:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__OPEN_TEMPLATE, counter); data/raft-0.9.25/src/uv_recv.c:74: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(s->address, address); data/raft-0.9.25/src/uv_segment.c:33:15: [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. matched = sscanf(filename, UV__CLOSED_TEMPLATE "%n", &info->first_index, data/raft-0.9.25/src/uv_segment.c:41:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(filename, UV__OPEN_TEMPLATE "%n", &info->counter, &consumed); data/raft-0.9.25/src/uv_segment.c:50: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(info->filename, filename); data/raft-0.9.25/src/uv_segment.c:584:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__CLOSED_TEMPLATE, first_index, end_index); data/raft-0.9.25/src/uv_segment.c:599:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(info->filename, filename); data/raft-0.9.25/src/uv_segment.c:891:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__CLOSED_TEMPLATE, first_index, last_index); data/raft-0.9.25/src/uv_segment.c:947:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__CLOSED_TEMPLATE, index, index); data/raft-0.9.25/src/uv_segment.c:1023:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__CLOSED_TEMPLATE, segment->first_index, index - 1); data/raft-0.9.25/src/uv_send.c:104: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(c->address, address); data/raft-0.9.25/src/uv_snapshot.c:35:15: [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. matched = sscanf(filename, UV__SNAPSHOT_META_TEMPLATE "%n", &info->term, data/raft-0.9.25/src/uv_snapshot.c:40: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(info->filename, filename); data/raft-0.9.25/src/uv_snapshot.c:48: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(filename, info->filename); data/raft-0.9.25/src/uv_snapshot.c:402:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__SNAPSHOT_META_TEMPLATE, put->snapshot->term, data/raft-0.9.25/src/uv_snapshot.c:412:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(filename, UV__SNAPSHOT_TEMPLATE, put->snapshot->term, data/raft-0.9.25/src/uv_tcp_connect.c:55: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(cursor, address); data/raft-0.9.25/test/integration/test_uv_init.c:174:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errmsg, "directory '%s' is not writable", f->dir); data/raft-0.9.25/test/integration/test_uv_tcp_listen.c:117: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(cursor, PEER_ADDRESS); data/raft-0.9.25/test/lib/dir.c:55:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(dir, "%s%s%s", parent, SEP, TEMPLATE); data/raft-0.9.25/test/lib/dir.c:161: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(path, dir); data/raft-0.9.25/test/lib/dir.c:163:5: [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(path, filename); data/raft-0.9.25/test/lib/munit.c:199: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(fp, format, ap); data/raft-0.9.25/test/lib/munit.c:1081:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(fp, "%" MUNIT_TEST_TIME_FORMAT, ((double) nanoseconds) / ((double) PSNIP_CLOCK_NSEC_PER_SEC)); data/raft-0.9.25/test/lib/munit.h:180:77: [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. # define MUNIT_PRINTF(string_index, first_to_check) __attribute__((format (printf, string_index, first_to_check))) data/raft-0.9.25/test/unit/test_uv_fs.c:49:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errmsg, "%s/sub", parent); data/raft-0.9.25/test/unit/test_uv_fs.c:50:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errmsg, "directory '%s' does not exist", dir); data/raft-0.9.25/test/unit/test_uv_fs.c:89:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errmsg, "directory '%s' is not writable", dir); data/raft-0.9.25/example/cluster.c:86:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned)(now.tv_nsec ^ now.tv_sec)); data/raft-0.9.25/example/cluster.c:93:31: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. interval.tv_sec = 1 + random() % 15; data/raft-0.9.25/example/cluster.c:102:24: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. i = (unsigned)(random() % N_SERVERS); data/raft-0.9.25/example/server.c:170:5: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom((unsigned)(now.tv_nsec ^ now.tv_sec)); data/raft-0.9.25/include/raft.h:485:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int (*random)(struct raft_io *io, int min, int max); data/raft-0.9.25/src/election.c:41:41: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. unsigned timeout = (unsigned)r->io->random(r->io, (int)r->election_timeout, data/raft-0.9.25/test/lib/dir.c:86:24: [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. return dirMakeTemp(getenv("RAFT_TMP_TMPFS")); data/raft-0.9.25/test/lib/dir.c:92:24: [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. return dirMakeTemp(getenv("RAFT_TMP_EXT4")); data/raft-0.9.25/test/lib/dir.c:98:24: [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. return dirMakeTemp(getenv("RAFT_TMP_BTRFS")); data/raft-0.9.25/test/lib/dir.c:104:24: [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. return dirMakeTemp(getenv("RAFT_TMP_ZFS")); data/raft-0.9.25/test/lib/dir.c:110:24: [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. return dirMakeTemp(getenv("RAFT_TMP_XFS")); data/raft-0.9.25/test/lib/munit.c:1849: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. return getenv("ANSICON") != NULL; data/raft-0.9.25/benchmark/os_disk_write.c:92:30: [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). arguments->buf = atoi(arg); data/raft-0.9.25/benchmark/os_disk_write.c:95:28: [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). arguments->n = atoi(arg); data/raft-0.9.25/benchmark/os_disk_write.c:130:11: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). *fd = mkstemp(*path); data/raft-0.9.25/benchmark/os_disk_write.c:147: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). dirfd = open(dir, O_RDONLY | O_DIRECTORY); data/raft-0.9.25/example/cluster.c:51: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(id, "%u", i + 1); data/raft-0.9.25/example/server.c:112: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 address[64]; /* Raft instance address. */ data/raft-0.9.25/example/server.c:206: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(s->address, "127.0.0.1:900%d", id); data/raft-0.9.25/example/server.c:219: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 address[64]; data/raft-0.9.25/example/server.c:221: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(address, "127.0.0.1:900%d", server_id); data/raft-0.9.25/example/server.c:386:20: [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). id = (unsigned)atoi(argv[2]); data/raft-0.9.25/include/raft.h:448: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/include/raft.h:692: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/include/raft/fixture.h:29: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 address[16]; /* Server address (stringified ID). */ data/raft-0.9.25/include/raft/uv.h:181: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/byte.c:182: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, buffer, 64); data/raft-0.9.25/src/byte.c:315: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->buffer[j], data, (i = 64 - j)); data/raft-0.9.25/src/byte.c:323: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(&s->buffer[j], &data[i], len - i); data/raft-0.9.25/src/entry.c:35: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(dst->buf.base, src->buf.base, dst->buf.len); data/raft-0.9.25/src/entry.c:79: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)[i].buf.base, src[i].buf.base, src[i].buf.len); data/raft-0.9.25/src/err.h:36: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 _errmsg[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/src/err.h:45: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(ERRMSG2, ERRMSG1, RAFT_ERRMSG_BUF_SIZE); \ data/raft-0.9.25/src/err.h:49: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(ERRMSG2, ERRMSG1, RAFT_ERRMSG_BUF_SIZE); \ data/raft-0.9.25/src/fixture.c:316: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(dst->data.base, src->data.base, src->data.len); data/raft-0.9.25/src/fixture.c:601: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(entries, io->entries, n * sizeof *io->entries); data/raft-0.9.25/src/fixture.c:917: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(s->address, "%llu", s->id); data/raft-0.9.25/src/fixture.c:1267: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(buf.base, entry->buf.base, buf.len); data/raft-0.9.25/src/log.c:456: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(&entries[i], entryAt(l, i), sizeof *entries); data/raft-0.9.25/src/raft.c:216: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(&digest, value + (sizeof value - sizeof digest), sizeof digest); data/raft-0.9.25/src/recv.c:117: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 msg[128]; data/raft-0.9.25/src/recv.c:122: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(msg, "remote term %lld is higher than %lld -> bump local term", data/raft-0.9.25/src/recv.c:125:9: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(msg, " and step down"); data/raft-0.9.25/src/snapshot.c:95: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(cursor, src->bufs[i].base, src->bufs[i].len); data/raft-0.9.25/src/tracing.h:14: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 _msg[1024]; \ data/raft-0.9.25/src/uv.c:276: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(new_segments, &(*segments)[i], new_n * sizeof *new_segments); data/raft-0.9.25/src/uv.c:313: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 snapshot_filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv.h:57: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 dir[UV__DIR_LEN]; /* Data directory */ data/raft-0.9.25/src/uv.h:120:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__SEGMENT_FILENAME_BUF_SIZE]; /* Segment filename */ data/raft-0.9.25/src/uv.h:227:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_finalize.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 filename1[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_finalize.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 filename2[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_finalize.c:36: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_fs.c:77: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:105: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:144: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:160: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:174: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:276: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:285:1: [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). open: data/raft-0.9.25/src/uv_fs.c:292: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). goto open; data/raft-0.9.25/src/uv_fs.c:429: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:477: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:505: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[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.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 path1[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:523: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 path2[UV__PATH_SZ]; data/raft-0.9.25/src/uv_fs.c:734: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 ignored[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_ip.c:12: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 buf[256]; data/raft-0.9.25/src/uv_ip.c:26:28: [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). rv = uv_ip4_addr(host, atoi(port), addr); data/raft-0.9.25/src/uv_metadata.c:61:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[METADATA_FILENAME_SIZE]; /* Filename of the metadata file */ data/raft-0.9.25/src/uv_metadata.c:176:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[METADATA_FILENAME_SIZE]; /* Filename of the metadata file */ data/raft-0.9.25/src/uv_os.c:120: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(sb, &req.statbuf, sizeof *sb); data/raft-0.9.25/src/uv_prepare.c:47: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; /* Error of threadpool callback */ data/raft-0.9.25/src/uv_prepare.c:49:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; /* Filename of the segment */ data/raft-0.9.25/src/uv_prepare.c:206:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_prepare.c:268: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_prepare.c:269:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_segment.c:164: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_segment.c:203: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_segment.c:361: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_segment.c:461: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_segment.c:579: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 filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_segment.c:646: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(base, b->arena.base, b->arena.len); data/raft-0.9.25/src/uv_segment.c:733: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(cursor, entry->buf.base, entry->buf.len); data/raft-0.9.25/src/uv_segment.c:776: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(b->arena.base, b->arena.base + retain * b->block_size, data/raft-0.9.25/src/uv_segment.c:880:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_segment.c:885: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_segment.c:943:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_segment.c:981:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_segment.c:987: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_snapshot.c:60: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 snapshot_filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_snapshot.c:63: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_snapshot.c:248:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_snapshot.c:307: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_snapshot.c:318: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_snapshot.c:328: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_snapshot.c:338: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 filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_snapshot.c:399:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[UV__FILENAME_LEN]; data/raft-0.9.25/src/uv_truncate.c:37: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/src/uv_writer.h: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 errmsg[256]; /* Error description (for thread-safety) */ data/raft-0.9.25/test/fuzzy/main_core.c:7:20: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. int main(int argc, char *argv[MUNIT_ARRAY_PARAM(argc + 1)]) data/raft-0.9.25/test/integration/test_assign.c:53: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 _address[16]; \ data/raft-0.9.25/test/integration/test_assign.c:57: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(_address, "%d", ID); \ data/raft-0.9.25/test/integration/test_election.c:534: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). CLUSTER_IO_FAULT(0, atoi(delay), 1); data/raft-0.9.25/test/integration/test_membership.c:55: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 address_[16]; \ data/raft-0.9.25/test/integration/test_membership.c:56: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(address_, "%d", ID); \ data/raft-0.9.25/test/integration/test_tick.c:22:20: [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). n_voting = atoi(n_voting_param); data/raft-0.9.25/test/integration/test_uv_init.c:68: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 filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/integration/test_uv_init.c:69: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(filename, "metadata%d", N); \ data/raft-0.9.25/test/integration/test_uv_init.c:173: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/integration/test_uv_load.c:241: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 _filename2[64]; \ data/raft-0.9.25/test/integration/test_uv_load.c:242: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(_filename2, "open-%u", (unsigned)COUNTER); \ data/raft-0.9.25/test/integration/test_uv_load.c:614:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[64]; data/raft-0.9.25/test/integration/test_uv_load.c:621: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(filename, "snapshot-1-8-%ju", now); data/raft-0.9.25/test/integration/test_uv_load.c:649:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[64]; data/raft-0.9.25/test/integration/test_uv_load.c:658: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(filename, "snapshot-2-6-%ju", now); data/raft-0.9.25/test/integration/test_uv_load.c:808: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 errmsg[128]; data/raft-0.9.25/test/integration/test_uv_load.c:813: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(errmsg, data/raft-0.9.25/test/integration/test_uv_recv.c:207: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((char *)&_handshake[24], "127.0.0.1:666"); \ data/raft-0.9.25/test/integration/test_uv_set_term.c:73: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 filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/integration/test_uv_set_term.c:74: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(filename, "metadata%d", N); \ data/raft-0.9.25/test/integration/test_uv_set_term.c:88: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 filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/integration/test_uv_set_term.c:89: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(filename, "metadata%d", N); \ data/raft-0.9.25/test/integration/test_uv_tcp_listen.c:214:28: [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). PEER_HANDSHAKE_PARTIAL(atoi(n)); data/raft-0.9.25/test/integration/test_uv_tcp_listen.c:279:28: [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). PEER_HANDSHAKE_PARTIAL(atoi(n_param)); data/raft-0.9.25/test/lib/aio.c:11: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 buf[256]; data/raft-0.9.25/test/lib/aio.c:18:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/proc/sys/fs/aio-max-nr", O_RDONLY); data/raft-0.9.25/test/lib/aio.c:26: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). limit = atoi(buf); data/raft-0.9.25/test/lib/aio.c:29:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/proc/sys/fs/aio-nr", O_RDONLY); data/raft-0.9.25/test/lib/aio.c:37:12: [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). used = atoi(buf); data/raft-0.9.25/test/lib/cluster.h:30:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). _n = atoi(munit_parameters_get(params, CLUSTER_N_PARAM)); \ data/raft-0.9.25/test/lib/cluster.h:34:17: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). atoi(munit_parameters_get(params, CLUSTER_PRE_VOTE_PARAM)); \ data/raft-0.9.25/test/lib/cluster.h:117:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). n_ = atoi(munit_parameters_get(params, CLUSTER_N_VOTING_PARAM)); \ data/raft-0.9.25/test/lib/dir.c:171: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[256]; data/raft-0.9.25/test/lib/dir.c:177:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); data/raft-0.9.25/test/lib/dir.c:203: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[256]; data/raft-0.9.25/test/lib/dir.c:210:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); data/raft-0.9.25/test/lib/dir.c:238: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[256]; data/raft-0.9.25/test/lib/dir.c:244:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); data/raft-0.9.25/test/lib/dir.c:256: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[256]; data/raft-0.9.25/test/lib/dir.c:265:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); data/raft-0.9.25/test/lib/dir.c:288: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 path1[256]; data/raft-0.9.25/test/lib/dir.c:289: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 path2[256]; data/raft-0.9.25/test/lib/dir.c:301: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[256]; data/raft-0.9.25/test/lib/dir.c:314: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[256]; data/raft-0.9.25/test/lib/dir.c:320:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_RDONLY); data/raft-0.9.25/test/lib/dir.c:350: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[256]; data/raft-0.9.25/test/lib/dir.c:361: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[256]; data/raft-0.9.25/test/lib/dir.c:366:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_RDONLY); data/raft-0.9.25/test/lib/dir.c:379: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[256]; data/raft-0.9.25/test/lib/dir.c:397:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); data/raft-0.9.25/test/lib/dir.c:405: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 buf[4096]; data/raft-0.9.25/test/lib/heap.c:103:28: [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). return value != NULL ? atoi(value) : 0; data/raft-0.9.25/test/lib/munit.c:268: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 munit_error_str[MUNIT_STRERROR_LEN]; data/raft-0.9.25/test/lib/munit.c:956: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(b, &rv, sizeof(munit_uint32_t)); data/raft-0.9.25/test/lib/munit.c:961: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(b, &rv, bytes_remaining); data/raft-0.9.25/test/lib/munit.c:1121: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(res, prefix, prefix_l); data/raft-0.9.25/test/lib/munit.c:1122: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(res + prefix_l, suffix, suffix_l); data/raft-0.9.25/test/lib/munit.c:1351:16: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). stderr_buf = tmpfile(); data/raft-0.9.25/test/lib/runner.h:24:24: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. int main(int argc, char *argv[MUNIT_ARRAY_PARAM(argc + 1)]) \ data/raft-0.9.25/test/lib/tcp.c:46: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(s->address, "127.0.0.1:%d", htons(addr.sin_port)); data/raft-0.9.25/test/lib/tcp.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(t->server.address, "127.0.0.1:%d", htons(addr.sin_port)); data/raft-0.9.25/test/lib/tcp.h:31: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 address[128]; /* IPv4 address of the server, with port */ data/raft-0.9.25/test/lib/tcp.h:57: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 address[128]; /* IPv4 address of the server, with port */ data/raft-0.9.25/test/unit/test_byte.c:128: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 _digest[41]; \ data/raft-0.9.25/test/unit/test_byte.c:132:13: [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(&_digest[_j], "%.2x", value[_i]); \ data/raft-0.9.25/test/unit/test_err.c:26: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_err.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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_err.c:52: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_err.c:62: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_err.c:72: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_err.c:82: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_log.c:38:9: [2] (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). Risk is low because the source is a constant string. strcpy(buf_.base, "hello"); \ data/raft-0.9.25/test/unit/test_log.c:931:38: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. munit_assert_string_equal((const char *)entries[0].buf.base, "hello"); data/raft-0.9.25/test/unit/test_uv_fs.c:17: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 _errmsg[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_fs.c:27: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 _errmsg[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_fs.c:47: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_uv_fs.c:48: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 dir[128]; data/raft-0.9.25/test/unit/test_uv_fs.c:88: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 errmsg[RAFT_ERRMSG_BUF_SIZE]; data/raft-0.9.25/test/unit/test_uv_fs.c:104: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 _errmsg[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_fs.c:129: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 errmsg_[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_fs.c:169: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 errmsg_[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_fs.c:204: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 buf[8]; data/raft-0.9.25/test/unit/test_uv_fs.c:259: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 errmsg_[RAFT_ERRMSG_BUF_SIZE]; \ data/raft-0.9.25/test/unit/test_uv_writer.c:22: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 errmsg[256]; data/raft-0.9.25/test/unit/test_uv_writer.c:189: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[UV__PATH_SZ]; data/raft-0.9.25/test/unit/test_uv_writer.c:190: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 errmsg[256]; data/raft-0.9.25/benchmark/os_disk_write.c:118:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). path = malloc(strlen(dir) + strlen("/bench-XXXXXX") + 1); data/raft-0.9.25/benchmark/os_disk_write.c:118:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). path = malloc(strlen(dir) + strlen("/bench-XXXXXX") + 1); data/raft-0.9.25/example/cluster.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). char *dir = malloc(strlen(topLevelDir) + strlen("/D") + 1); data/raft-0.9.25/example/cluster.c:41: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). char *dir = malloc(strlen(topLevelDir) + strlen("/D") + 1); data/raft-0.9.25/src/byte.h:111: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). *p += strlen(value) + 1; data/raft-0.9.25/src/configuration.c:148: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). server->address = raft_malloc(strlen(address) + 1); data/raft-0.9.25/src/configuration.c:228:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). n += strlen(server->address) + 1; /* Address */ data/raft-0.9.25/src/err.c:9: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). #define WRAP_SEP_LEN (size_t)strlen(WRAP_SEP) data/raft-0.9.25/src/err.c:20: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). prefix_n = strlen(format); data/raft-0.9.25/src/raft.c:40:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). r->address = HeapMalloc(strlen(address) + 1); data/raft-0.9.25/src/raft.c:212:60: [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). byteSha1Update(&sha1, (const uint8_t *)text, (uint32_t)strlen(text)); data/raft-0.9.25/src/recv.c:211:59: [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). r->follower_state.current_leader.address = HeapMalloc(strlen(address) + 1); data/raft-0.9.25/src/uv_fs.c:409:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = (int)read(fd, buf->base, buf->len); data/raft-0.9.25/src/uv_list.c:20: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(filename) >= UV__FILENAME_LEN) { data/raft-0.9.25/src/uv_os.c:150:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(path, "/"); data/raft-0.9.25/src/uv_recv.c:70:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s->address = HeapMalloc(strlen(address) + 1); data/raft-0.9.25/src/uv_send.c:98:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). c->address = HeapMalloc(strlen(address) + 1); data/raft-0.9.25/src/uv_snapshot.c:33:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t filename_len = strlen(filename); data/raft-0.9.25/src/uv_snapshot.c:46:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(info->filename) - strlen(".meta"); data/raft-0.9.25/src/uv_snapshot.c:46:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(info->filename) - strlen(".meta"); data/raft-0.9.25/src/uv_tcp_connect.c:42:36: [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 address_len = bytePad64(strlen(address) + 1); data/raft-0.9.25/src/uv_writer.c:154:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = (int)read(w->event_fd, &completed, sizeof completed); data/raft-0.9.25/test/integration/test_uv_init.c:68: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). char filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/integration/test_uv_set_term.c:73: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). char filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/integration/test_uv_set_term.c:88: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). char filename[strlen("metadataN") + 1]; \ data/raft-0.9.25/test/lib/aio.c:21:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = read(fd, buf, sizeof buf); data/raft-0.9.25/test/lib/aio.c:32:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = read(fd, buf, sizeof buf); data/raft-0.9.25/test/lib/dir.c:54:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). dir = munit_malloc(strlen(parent) + strlen(SEP) + strlen(TEMPLATE) + 1); data/raft-0.9.25/test/lib/dir.c:54:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). dir = munit_malloc(strlen(parent) + strlen(SEP) + strlen(TEMPLATE) + 1); data/raft-0.9.25/test/lib/dir.c:54: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). dir = munit_malloc(strlen(parent) + strlen(SEP) + strlen(TEMPLATE) + 1); data/raft-0.9.25/test/lib/dir.c:162:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(path, "/"); data/raft-0.9.25/test/lib/dir.c:326:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = read(fd, buf, n); data/raft-0.9.25/test/lib/munit.c:1107:44: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const size_t prefix_l = prefix != NULL ? strlen(prefix) : 0; data/raft-0.9.25/test/lib/munit.c:1108:44: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const size_t suffix_l = suffix != NULL ? strlen(suffix) : 0; data/raft-0.9.25/test/lib/munit.c:1164:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(from, buf, sizeof(buf)); data/raft-0.9.25/test/lib/munit.c:1412:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_res = read(pipefd[0], ((munit_uint8_t*) (&report)) + bytes_read, sizeof(report) - bytes_read); data/raft-0.9.25/test/lib/munit.c:1692:53: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncmp(test->name, *test_name + pre_l, strlen(*test_name + pre_l)) == 0) { data/raft-0.9.25/test/unit/test_configuration.c:421:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). 8 + strlen(address) + 1; /* Server */ data/raft-0.9.25/test/unit/test_configuration.c:432:54: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). munit_assert_string_equal(byteGetString(&cursor, strlen(address) + 1), data/raft-0.9.25/test/unit/test_configuration.c:456:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). 8 + strlen(address1) + 1 + 1 + /* Server 1 */ data/raft-0.9.25/test/unit/test_configuration.c:457:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). 8 + strlen(address2) + 1 + 1; /* Server 2 */ data/raft-0.9.25/test/unit/test_configuration.c:468:54: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). munit_assert_string_equal(byteGetString(&cursor, strlen(address1) + 1), data/raft-0.9.25/test/unit/test_configuration.c:473:54: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). munit_assert_string_equal(byteGetString(&cursor, strlen(address2) + 1), ANALYSIS SUMMARY: Hits = 278 Lines analyzed = 37854 in approximately 0.96 seconds (39465 lines/second) Physical Source Lines of Code (SLOC) = 26489 Hits@level = [0] 47 [1] 43 [2] 175 [3] 12 [4] 44 [5] 4 Hits@level+ = [0+] 325 [1+] 278 [2+] 235 [3+] 60 [4+] 48 [5+] 4 Hits/KSLOC@level+ = [0+] 12.2692 [1+] 10.4949 [2+] 8.87161 [3+] 2.26509 [4+] 1.81207 [5+] 0.151006 Dot directories skipped = 2 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.