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/traildb-0.6+dfsg1/src/dsfmt/dSFMT.c Examining data/traildb-0.6+dfsg1/src/dsfmt/dSFMT-params.h Examining data/traildb-0.6+dfsg1/src/dsfmt/dSFMT-common.h Examining data/traildb-0.6+dfsg1/src/dsfmt/dSFMT-params521.h Examining data/traildb-0.6+dfsg1/src/dsfmt/dSFMT.h Examining data/traildb-0.6+dfsg1/src/tdb_profile.h Examining data/traildb-0.6+dfsg1/src/tdb_multi_cursor.c Examining data/traildb-0.6+dfsg1/src/tdb_types.h Examining data/traildb-0.6+dfsg1/src/tdb_uuid.c Examining data/traildb-0.6+dfsg1/src/tdb_cons_package.c Examining data/traildb-0.6+dfsg1/src/tdb_queue.c Examining data/traildb-0.6+dfsg1/src/tdb_decode.c Examining data/traildb-0.6+dfsg1/src/tdb_package.c Examining data/traildb-0.6+dfsg1/src/pqueue/pqueue.c Examining data/traildb-0.6+dfsg1/src/pqueue/pqueue.h Examining data/traildb-0.6+dfsg1/src/tdb.c Examining data/traildb-0.6+dfsg1/src/arena.c Examining data/traildb-0.6+dfsg1/src/tdb_limits.h Examining data/traildb-0.6+dfsg1/src/traildb.h Examining data/traildb-0.6+dfsg1/src/tdb_error.h Examining data/traildb-0.6+dfsg1/src/tdb_huffman.h Examining data/traildb-0.6+dfsg1/src/arena.h Examining data/traildb-0.6+dfsg1/src/tdb_internal.h Examining data/traildb-0.6+dfsg1/src/tdb_bits.h Examining data/traildb-0.6+dfsg1/src/judy_128_map.c Examining data/traildb-0.6+dfsg1/src/judy_str_map.h Examining data/traildb-0.6+dfsg1/src/tdb_io.h Examining data/traildb-0.6+dfsg1/src/judy_128_map.h Examining data/traildb-0.6+dfsg1/src/tdb_encode.c Examining data/traildb-0.6+dfsg1/src/tdb_encode_model.h Examining data/traildb-0.6+dfsg1/src/judy_str_map.c Examining data/traildb-0.6+dfsg1/src/tdb_queue.h Examining data/traildb-0.6+dfsg1/src/tdb_cons.c Examining data/traildb-0.6+dfsg1/src/xxhash/xxhash.c Examining data/traildb-0.6+dfsg1/src/xxhash/xxhash.h Examining data/traildb-0.6+dfsg1/src/tdb_package.h Examining data/traildb-0.6+dfsg1/src/tdb_huffman.c Examining data/traildb-0.6+dfsg1/src/tdb_encode_model.c Examining data/traildb-0.6+dfsg1/util/traildb_bench.c Examining data/traildb-0.6+dfsg1/tests/c-tests-large/large_lexicon.c Examining data/traildb-0.6+dfsg1/tests/c-tests/event_filter_simple.c Examining data/traildb-0.6+dfsg1/tests/c-tests/really_lots_of_fields.c Examining data/traildb-0.6+dfsg1/tests/c-tests/judy_str_map_test.c Examining data/traildb-0.6+dfsg1/tests/c-tests/get_item.c Examining data/traildb-0.6+dfsg1/tests/c-tests/tdb_test.h Examining data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c Examining data/traildb-0.6+dfsg1/tests/c-tests/open_close_memory_leaks.c Examining data/traildb-0.6+dfsg1/tests/c-tests/judy_128_map_test.c Examining data/traildb-0.6+dfsg1/tests/c-tests/event_filter_get_time_range.c Examining data/traildb-0.6+dfsg1/tests/c-tests/basic_lexicon.c Examining data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c Examining data/traildb-0.6+dfsg1/tests/c-tests/init_close_crash_bug.c Examining data/traildb-0.6+dfsg1/tests/c-tests/basic_versioning.c Examining data/traildb-0.6+dfsg1/tests/c-tests/basic_cursor.c Examining data/traildb-0.6+dfsg1/tests/c-tests/opt_only_diff_items.c Examining data/traildb-0.6+dfsg1/tests/c-tests/tdb_cons_setopt.c Examining data/traildb-0.6+dfsg1/tests/c-tests/free_test.c Examining data/traildb-0.6+dfsg1/tests/c-tests/dontneed_crash_bug.c Examining data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c Examining data/traildb-0.6+dfsg1/tests/c-tests/willneed_crash_bug.c Examining data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c Examining data/traildb-0.6+dfsg1/tests/c-tests/uuid_encoding.c Examining data/traildb-0.6+dfsg1/tests/c-tests/opt_event_filter.c Examining data/traildb-0.6+dfsg1/tests/c-tests/out_of_memory.c Examining data/traildb-0.6+dfsg1/tests/c-tests/zero_fields.c Examining data/traildb-0.6+dfsg1/tests/c-tests/time_range_filter_simple.c Examining data/traildb-0.6+dfsg1/tests/c-tests/smoke_test.c Examining data/traildb-0.6+dfsg1/tests/c-tests/bit_operations.c Examining data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c Examining data/traildb-0.6+dfsg1/tests/c-tests/multi_cursor.c Examining data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c Examining data/traildb-0.6+dfsg1/tests/c-tests/dsfmt_sanity_test.c Examining data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c Examining data/traildb-0.6+dfsg1/tests/c-tests/empty_tdb_cons.c Examining data/traildb-0.6+dfsg1/tests/c-tests/event_filter_get_item.c Examining data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c Examining data/traildb-0.6+dfsg1/tests/c-tests/item_encoding.c Examining data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c Examining data/traildb-0.6+dfsg1/tests/c-tests/field_names.c Examining data/traildb-0.6+dfsg1/tdbcli/tdb_index.c Examining data/traildb-0.6+dfsg1/tdbcli/main.c Examining data/traildb-0.6+dfsg1/tdbcli/thread_util.h Examining data/traildb-0.6+dfsg1/tdbcli/thread_util.c Examining data/traildb-0.6+dfsg1/tdbcli/filter.c Examining data/traildb-0.6+dfsg1/tdbcli/op_index.c Examining data/traildb-0.6+dfsg1/tdbcli/tdb_index.h Examining data/traildb-0.6+dfsg1/tdbcli/op_merge.c Examining data/traildb-0.6+dfsg1/tdbcli/tdbcli.h Examining data/traildb-0.6+dfsg1/tdbcli/jsmn/jsmn.h Examining data/traildb-0.6+dfsg1/tdbcli/jsmn/jsmn.c Examining data/traildb-0.6+dfsg1/tdbcli/op_dump.c Examining data/traildb-0.6+dfsg1/tdbcli/op_make.c Examining data/traildb-0.6+dfsg1/examples/tutorial_wikipedia_sessions.c Examining data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c FINAL RESULTS: data/traildb-0.6+dfsg1/src/tdb.c:263:13: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (fscanf(f, "%"PRIu64, &db->version) != 1) data/traildb-0.6+dfsg1/src/tdb.c:280:9: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (fscanf(f, data/traildb-0.6+dfsg1/src/tdb_cons_package.c:41:5: [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, aptr); data/traildb-0.6+dfsg1/src/tdb_io.h:35:9: [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. if (fprintf(file, fmt, ##__VA_ARGS__) < 1){\ data/traildb-0.6+dfsg1/src/tdb_io.h:79:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (vsnprintf(path, TDB_MAX_PATH_SIZE, fmt, aptr) >= TDB_MAX_PATH_SIZE) data/traildb-0.6+dfsg1/tdbcli/op_dump.c:15:9: [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. if (fprintf(output, fmt, ##__VA_ARGS__) < 1){\ data/traildb-0.6+dfsg1/tdbcli/op_dump.c:36:15: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. len = sprintf(tstamp_str, "%"PRIu64, event->timestamp); data/traildb-0.6+dfsg1/tdbcli/op_dump.c:214:10: [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(opt->output, W_OK)) data/traildb-0.6+dfsg1/tdbcli/op_index.c:35:10: [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(out_path, W_OK)) data/traildb-0.6+dfsg1/tdbcli/op_make.c:406:10: [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(opt->output, W_OK)) data/traildb-0.6+dfsg1/tdbcli/op_make.c:410:10: [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(output_file, W_OK)) data/traildb-0.6+dfsg1/tdbcli/tdbcli.h:12:10: [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. do { fprintf(stderr, msg"\n", ##__VA_ARGS__); \ data/traildb-0.6+dfsg1/tdbcli/tdbcli.h:17:10: [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. do { fprintf(stderr, msg"\n", ##__VA_ARGS__); \ data/traildb-0.6+dfsg1/tests/c-tests/tdb_cons_setopt.c:20: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(pkgname, getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/util/traildb_bench.c:13: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(stderr, (fmt), ##__VA_ARGS__); \ data/traildb-0.6+dfsg1/util/traildb_bench.c:18: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(stderr, ("WARNING: " fmt), ##__VA_ARGS__); \ data/traildb-0.6+dfsg1/src/tdb_encode_model.c:50:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TDB_SAMPLE_SIZE")){ data/traildb-0.6+dfsg1/src/tdb_encode_model.c:52:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. d = strtod(getenv("TDB_SAMPLE_SIZE"), &endptr); data/traildb-0.6+dfsg1/src/tdb_huffman.c:275:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TDB_DEBUG_HUFFMAN")) data/traildb-0.6+dfsg1/tdbcli/main.c:192:13: [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, data/traildb-0.6+dfsg1/tests/c-tests-large/large_lexicon.c:26:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests-large/large_lexicon.c:39: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:216:22: [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. empty_tdb_append(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:217: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. mismatching_fields(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:218:19: [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. simple_append(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:219:17: [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. empty_value(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/basic_cursor.c:26:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_cursor.c:45: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_lexicon.c:31:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_lexicon.c:41: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_versioning.c:12:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 0) == 0); data/traildb-0.6+dfsg1/tests/c-tests/basic_versioning.c:17: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/empty_tdb_cons.c:12:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 0) == 0); data/traildb-0.6+dfsg1/tests/c-tests/empty_tdb_cons.c:16: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c:49:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c:68: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_simple.c:30:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 3) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_simple.c:41: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c:26:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 1) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c:41: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c:184:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tdb_path(path, "%s.1", getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/field_names.c:13:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 5) == 0); data/traildb-0.6+dfsg1/tests/c-tests/field_names.c:17: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/get_item.c:26:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields_ptr, NUM_FIELDS) == 0); data/traildb-0.6+dfsg1/tests/c-tests/get_item.c:32: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c:32:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), NULL, 0) == 0); data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c:48: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:23:25: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. getenv("TDB_TMP_DIR"), data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:32:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 1) == TDB_ERR_INVALID_FIELDNAME); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:40:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 2) == TDB_ERR_DUPLICATE_FIELDS); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:47:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 1) == TDB_ERR_INVALID_FIELDNAME); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:55:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 1) == TDB_ERR_INVALID_FIELDNAME); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:66:33: [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. getenv("TDB_TMP_DIR"), data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:79:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 1) == TDB_ERR_INVALID_FIELDNAME); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:86:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), bad, 1) == TDB_ERR_INVALID_FIELDNAME); data/traildb-0.6+dfsg1/tests/c-tests/multi_cursor.c:186: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. const char *root = getenv("TDB_TMP_DIR"); data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c:37:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c:49: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/open_close_memory_leaks.c:73:17: [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. do_cons(getenv("TDB_TMP_DIR"), 0); data/traildb-0.6+dfsg1/tests/c-tests/open_close_memory_leaks.c:76:17: [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. do_cons(getenv("TDB_TMP_DIR"), 1); data/traildb-0.6+dfsg1/tests/c-tests/open_close_memory_leaks.c:79:17: [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. do_open(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/opt_event_filter.c:25:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 2) == 0); data/traildb-0.6+dfsg1/tests/c-tests/opt_event_filter.c:35: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/opt_event_filter.c:63:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tdb_path(path, "%s/%u", getenv("TDB_TMP_DIR"), 1); data/traildb-0.6+dfsg1/tests/c-tests/opt_only_diff_items.c:114:17: [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. simple_case(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/opt_only_diff_items.c:115:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. two_field_case(getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/out_of_memory.c:42:33: [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. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 1) == 0); data/traildb-0.6+dfsg1/tests/c-tests/really_lots_of_fields.c:24:26: [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. getenv("TDB_TMP_DIR"), data/traildb-0.6+dfsg1/tests/c-tests/really_lots_of_fields.c:31:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields_ptr, TDB_MAX_NUM_FIELDS) == 0); data/traildb-0.6+dfsg1/tests/c-tests/really_lots_of_fields.c:35: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/tdb_cons_setopt.c:20:21: [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. strcpy(pkgname, getenv("TDB_TMP_DIR")); data/traildb-0.6+dfsg1/tests/c-tests/tdb_test.h:11:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TDB_CONS_NO_BIGRAMS")) { data/traildb-0.6+dfsg1/tests/c-tests/tdb_test.h:21:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TDB_CONS_OUTPUT_FORMAT")){ data/traildb-0.6+dfsg1/tests/c-tests/time_range_filter_simple.c:32:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 3) == 0); data/traildb-0.6+dfsg1/tests/c-tests/time_range_filter_simple.c:43: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:40:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 0) == 0); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:63: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c:31:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 3) == 0); data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c:48: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c:67: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. tdb *db = make_tdb(getenv("TDB_TMP_DIR"), TSTAMPS1, num_events, 0); data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c:77:19: [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. db = make_tdb(getenv("TDB_TMP_DIR"), TSTAMPS2, num_events, 0); data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c:88:19: [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. db = make_tdb(getenv("TDB_TMP_DIR"), TSTAMPS3, num_events, 0); data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c:97:14: [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. make_tdb(getenv("TDB_TMP_DIR"), TSTAMPS4, sizeof(TSTAMPS4) / sizeof(TSTAMPS4[0]), 1); data/traildb-0.6+dfsg1/tests/c-tests/wide_timestamps.c:98:14: [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. make_tdb(getenv("TDB_TMP_DIR"), TSTAMPS5, sizeof(TSTAMPS5) / sizeof(TSTAMPS5[0]), 1); data/traildb-0.6+dfsg1/tests/c-tests/zero_fields.c:15:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert(tdb_cons_open(c, getenv("TDB_TMP_DIR"), fields, 0) == 0); data/traildb-0.6+dfsg1/tests/c-tests/zero_fields.c:34: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. assert(tdb_open(t, getenv("TDB_TMP_DIR")) == 0); data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c:19:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char username[6]; data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c:27: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(uuid, &i, 4); data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c:28: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(username, "user%d", i); data/traildb-0.6+dfsg1/src/judy_str_map.c:21: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 value[0]; data/traildb-0.6+dfsg1/src/judy_str_map.c:92: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(&jsm->buffer[jsm->buffer_offset], &item, sizeof(item)); data/traildb-0.6+dfsg1/src/judy_str_map.c:94: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(&jsm->buffer[jsm->buffer_offset], buf, length); data/traildb-0.6+dfsg1/src/judy_str_map.c:182:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *in = fopen(argv[1], "r"); data/traildb-0.6+dfsg1/src/pqueue/pqueue.c:279: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(dup->d, q->d, (q->size * sizeof(void *))); data/traildb-0.6+dfsg1/src/tdb.c:31:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE* (*fopen)(const char *fname, const char *root, const tdb *db); data/traildb-0.6+dfsg1/src/tdb.c:46: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb.c:57:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) == -1) data/traildb-0.6+dfsg1/src/tdb.c:87: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb.c:114: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(&lex->size, lex->data, 8); data/traildb-0.6+dfsg1/src/tdb.c:118: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(&lex->size, lex->data, 4); data/traildb-0.6+dfsg1/src/tdb.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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb.c:152:19: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = io->fopen("fields", root, db))) data/traildb-0.6+dfsg1/src/tdb.c:188:19: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = io->fopen("fields", root, db))){ data/traildb-0.6+dfsg1/src/tdb.c:260:19: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = io->fopen("version", root, db))) data/traildb-0.6+dfsg1/src/tdb.c:277:19: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = io->fopen("info", root, db))) data/traildb-0.6+dfsg1/src/tdb.c:300: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 root[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb.c:557:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&key, uuid, 16); data/traildb-0.6+dfsg1/src/tdb.c:563:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&cmp, &db->uuids.data[idx * 16], 16); data/traildb-0.6+dfsg1/src/tdb.c:578:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&cmp, &db->uuids.data[idx * 16], 16); data/traildb-0.6+dfsg1/src/tdb_cons.c:113: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons.c:134: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons.c:159: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons.c:301:15: [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). if ((fd = mkstemp(cons->tempfile)) == -1){ data/traildb-0.6+dfsg1/src/tdb_cons.c:371: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(&uuid_key, uuid, 16); data/traildb-0.6+dfsg1/src/tdb_cons.c:407: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, &item, sizeof(tdb_item)); data/traildb-0.6+dfsg1/src/tdb_cons.c:562: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, &item, sizeof(tdb_item)); data/traildb-0.6+dfsg1/src/tdb_cons.c:605:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&uuid_key, tdb_get_uuid(db, trail_id), 16); data/traildb-0.6+dfsg1/src/tdb_cons_package.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 buffer[BUFFER_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:83: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:91:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) == -1){ data/traildb-0.6+dfsg1/src/tdb_cons_package.c:241: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:264: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 buffer[BUFFER_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.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 dst_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:319: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:344:15: [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). if ((fd = mkstemp(dst_path)) == -1){ data/traildb-0.6+dfsg1/src/tdb_encode.c:319:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(new_buf, buf, offs / 8 + 1); data/traildb-0.6+dfsg1/src/tdb_encode.c:401: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_encode.c:402: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 grouped_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_encode.c:403: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 toc_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_encode.c:439:15: [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). if ((fd = mkstemp(grouped_path)) == -1){ data/traildb-0.6+dfsg1/src/tdb_internal.h:109: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 tempfile[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/src/tdb_io.h:13:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(file = fopen(path, mode))){\ data/traildb-0.6+dfsg1/src/tdb_io.h:70:21: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static int tdb_path(char path[TDB_MAX_PATH_SIZE], data/traildb-0.6+dfsg1/src/tdb_io.h:74:21: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static int tdb_path(char path[TDB_MAX_PATH_SIZE], char *fmt, ...) data/traildb-0.6+dfsg1/src/xxhash/xxhash.c:117:76: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } data/traildb-0.6+dfsg1/tdbcli/filter.c:42:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) == -1) data/traildb-0.6+dfsg1/tdbcli/filter.c:175:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = fopen(fname, "r"))) data/traildb-0.6+dfsg1/tdbcli/op_dump.c:26:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char tstamp_str[21]; data/traildb-0.6+dfsg1/tdbcli/op_dump.c:217:24: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(output = fopen(opt->output, "w"))) data/traildb-0.6+dfsg1/tdbcli/op_index.c:15: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 in_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tdbcli/op_index.c:16: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 out_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tdbcli/op_make.c:32: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(hexuuid, token, len); data/traildb-0.6+dfsg1/tdbcli/op_make.c:400:23: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(input = fopen(opt->input, "r"))) data/traildb-0.6+dfsg1/tdbcli/op_merge.c:102: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 fieldname[TDB_MAX_FIELDNAME_LENGTH + 1]; data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:345:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&dedup_key, key, 8); data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:467:15: [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). if ((fd = mkstemp(path)) == -1) data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:531: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(&width, data, 4); data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:534: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(num_pages, index->data + offsets[idx], 2); data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:538: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(num_pages, index->data + offsets[idx], 2); data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:639: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:644:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) != -1) data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:648:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) != -1) data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:652:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(path, O_RDONLY)) != -1) data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:684:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(index_path, O_RDONLY)) == -1) data/traildb-0.6+dfsg1/tdbcli/tdb_index.c:725:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp_path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tdbcli/tdbcli.h:34:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *field_names[TDB_MAX_NUM_FIELDS]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:14: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:40: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:71: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 value1[1]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.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 value2[1]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.c:80:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/basic_append.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 path[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/basic_cursor.c:30: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(uuid, &i, 8); data/traildb-0.6+dfsg1/tests/c-tests/bit_operations.c:36: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[num_words * 8], &tmp, 8); data/traildb-0.6+dfsg1/tests/c-tests/bit_operations.c:37: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(&val, &tmp, 8); data/traildb-0.6+dfsg1/tests/c-tests/bit_operations.c:45:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char src_rand[(NUM_WORDS + 1) * 8]; data/traildb-0.6+dfsg1/tests/c-tests/bit_operations.c:46:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char dst_rand[(NUM_WORDS + 1) * 8]; data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c:33:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&val, tdb_get_item_value(t, event->items[0], &tmp), 4); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c:53:15: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *event[2]; data/traildb-0.6+dfsg1/tests/c-tests/event_filter_large.c:60: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(uuid, &i, 4); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c:28: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(uuid, &i, 8); data/traildb-0.6+dfsg1/tests/c-tests/event_filter_trail_opt.c:182: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/get_item.c:20: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(&fields[i * 11], "%u", i); data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c:38:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(uuid, &tmp, 3); data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c:39:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&key, &tmp, 3); data/traildb-0.6+dfsg1/tests/c-tests/get_trail_id.c:61: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(uuid, &key, 3); data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:13:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[TDB_MAX_FIELDNAME_LENGTH + 1]; data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:14:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *bad[TDB_MAX_NUM_FIELDS + 1]; data/traildb-0.6+dfsg1/tests/c-tests/invalid_fields.c:44: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(buf, "time"); data/traildb-0.6+dfsg1/tests/c-tests/judy_128_map_test.c: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(&ret, &rand, 8); data/traildb-0.6+dfsg1/tests/c-tests/judy_str_map_test.c:25:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(state, &id, 8); data/traildb-0.6+dfsg1/tests/c-tests/judy_str_map_test.c:51: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(&key, &rand, 8); data/traildb-0.6+dfsg1/tests/c-tests/multi_cursor.c:17: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/multi_cursor.c:31: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(uuid, &i, 4); data/traildb-0.6+dfsg1/tests/c-tests/multi_cursor.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(&id, val, 4); data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c:13: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 value[2]; data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c:41: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(uuid, &i, 4); data/traildb-0.6+dfsg1/tests/c-tests/off_by_one_encoding_bug.c:57:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(uuid, &i, 4); data/traildb-0.6+dfsg1/tests/c-tests/open_close_memory_leaks.c:32: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(&fields[i * 11], "%u", i); data/traildb-0.6+dfsg1/tests/c-tests/opt_event_filter.c:14: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[TDB_MAX_PATH_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/out_of_memory.c:27:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char value[VALUE_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/out_of_memory.c:53:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(value, &i, 4); data/traildb-0.6+dfsg1/tests/c-tests/really_lots_of_fields.c:18: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(&fields[i * 11], "%u", i); data/traildb-0.6+dfsg1/tests/c-tests/tdb_cons_setopt.c:19: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 pkgname[4096]; data/traildb-0.6+dfsg1/tests/c-tests/tdb_cons_setopt.c:21:5: [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(pkgname, "test.tdb"); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:24: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(uuid, rand, 16); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:46: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(&key, uuid, 8); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:72: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(&this_uuid, tdb_get_uuid(t, i), 16); data/traildb-0.6+dfsg1/tests/c-tests/uuid_ordering.c:77: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(&key, &this_uuid, 8); data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c:16:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer1[MAX_VALUE_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c:17:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer2[MAX_VALUE_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/what_you_write_you_get_back.c:18:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer3[MAX_VALUE_SIZE]; data/traildb-0.6+dfsg1/tests/c-tests/zero_fields.c:23: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(uuid, &i, 4); data/traildb-0.6+dfsg1/util/traildb_bench.c:37: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(&p, &argv, sizeof(argv)); data/traildb-0.6+dfsg1/util/traildb_bench.c:332: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(&make_compiler_happy, field_ids + i, sizeof(void*)); data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c:34: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). uint64_t lengths[] = {strlen(username), strlen(EVENTS[j])}; data/traildb-0.6+dfsg1/examples/tutorial_simple_traildb.c:34: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). uint64_t lengths[] = {strlen(username), strlen(EVENTS[j])}; data/traildb-0.6+dfsg1/src/judy_str_map.c:186:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/traildb-0.6+dfsg1/src/tdb.c:136: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). *length = (uint64_t)strlen(&lex->data[tdb_lex_offset(lex, i)]); data/traildb-0.6+dfsg1/src/tdb.c:197: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). line[strlen(line) - 1] = 0; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:116:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r = read(fd, buffer, BUFFER_SIZE); data/traildb-0.6+dfsg1/src/tdb_cons_package.c:181: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). uint64_t i, size = strlen(TOC_FILE) + VALUE_SIZE + strlen(TDB_TAR_MAGIC); data/traildb-0.6+dfsg1/src/tdb_cons_package.c:181:56: [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). uint64_t i, size = strlen(TOC_FILE) + VALUE_SIZE + strlen(TDB_TAR_MAGIC); data/traildb-0.6+dfsg1/src/tdb_cons_package.c:186:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size += strlen(HEADER_FILES[i]) + VALUE_SIZE; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:189:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size += strlen(DATA_FILES[i]) + VALUE_SIZE; data/traildb-0.6+dfsg1/src/tdb_cons_package.c:192:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size += strlen(cons->ofield_names[i]) + LEXICON_PREFIX_LEN + VALUE_SIZE; data/traildb-0.6+dfsg1/tdbcli/filter.c:99:49: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). item = tdb_get_item(db, field, val, strlen(val)); data/traildb-0.6+dfsg1/tdbcli/filter.c:152: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(uuidstr) != 32 || tdb_uuid_raw(uuidstr, uuid)){ data/traildb-0.6+dfsg1/tdbcli/filter.c:180: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). line[strlen(line) - 1] = 0; data/traildb-0.6+dfsg1/tdbcli/main.c:217: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). if (strlen(optarg) != 1) data/traildb-0.6+dfsg1/tdbcli/op_make.c:212: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). strlen(fieldstr), data/traildb-0.6+dfsg1/tdbcli/op_make.c:252: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). Word_t len = strlen(opt->field_names[i]); ANALYSIS SUMMARY: Hits = 222 Lines analyzed = 16438 in approximately 0.45 seconds (36430 lines/second) Physical Source Lines of Code (SLOC) = 11830 Hits@level = [0] 64 [1] 17 [2] 119 [3] 70 [4] 16 [5] 0 Hits@level+ = [0+] 286 [1+] 222 [2+] 205 [3+] 86 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 24.1758 [1+] 18.7658 [2+] 17.3288 [3+] 7.26965 [4+] 1.35249 [5+] 0 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.