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/dmlc-core-0.0~git20200912.bfad207/example/parameter.cc Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/any.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/array_view.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/blockingconcurrentqueue.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/build_config_default.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/common.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/concurrency.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/concurrentqueue.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/config.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/endian.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/filesystem.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/input_split_shuffle.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/io.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/json.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/lua.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory_io.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/optional.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/recordio.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/serializer.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/strtonum.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/thread_group.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/thread_local.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/threadediter.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/timer.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/type_traits.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/base.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/data.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/logging.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/omp.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/parameter.h Examining data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/registry.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/config.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/data.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/basic_row_iter.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/csv_parser.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/disk_row_iter.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/libfm_parser.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/libsvm_parser.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/parser.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/row_block.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/data/text_parser.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/azure_filesys.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/azure_filesys.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/cached_input_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/filesys.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/hdfs_filesys.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/indexed_recordio_split.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/indexed_recordio_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/input_split_base.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/input_split_base.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/line_split.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/line_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/recordio_split.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/recordio_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/single_file_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/single_threaded_input_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/threaded_input_split.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/uri_spec.h Examining data/dmlc-core-0.0~git20200912.bfad207/src/io/hdfs_filesys.cc Examining data/dmlc-core-0.0~git20200912.bfad207/src/recordio.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/csv_parser_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/dataiter_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/filesys_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/iostream_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/libfm_parser_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/libsvm_parser_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/logging_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/parameter_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/registry_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/split_read_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/split_repeat_read_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/split_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/stream_read_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/strtonum_test.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_any.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_array_view.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_config.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_env.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_inputsplit.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_json.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_lockfree.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_main.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_optional.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_parser.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_serializer.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_tempdir.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_threaditer.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_threaditer_exc_handling.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_logging.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_param.cc Examining data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_thread_group.cc FINAL RESULTS: data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/base.h:194: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. #define snprintf sprintf_s data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/base.h:195: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. #define vsnprintf vsprintf_s data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/filesystem.h:94:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpenv = getenv("TMPDIR"); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/logging.h:41:23: [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 (auto var = std::getenv("DMLC_LOG_STACK_TRACE_DEPTH")) { data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/logging.h:151: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. if (auto var = std::getenv("DMLC_LOG_DEBUG")) { data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/optional.h:234:10: [3] (random) setstate: 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. is.setstate(std::ios::failbit); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/parameter.h:633:14: [3] (random) setstate: 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. is.setstate(std::ios::failbit); break; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/parameter.h:1154: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. const char *val = getenv(key); data/dmlc-core-0.0~git20200912.bfad207/src/io/azure_filesys.cc:32: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. const char *name = getenv("AZURE_STORAGE_ACCOUNT"); data/dmlc-core-0.0~git20200912.bfad207/src/io/azure_filesys.cc:33: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. const char* key = getenv("AZURE_STORAGE_ACCESS_KEY"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:781:23: [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 *buz = getenv("DMLC_S3_WRITE_BUFFER_MB"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1151:23: [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 *isAWS = getenv("S3_IS_AWS"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1152:23: [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 *keyid = getenv("S3_ACCESS_KEY_ID"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1153: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 *seckey = getenv("S3_SECRET_ACCESS_KEY"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1154:23: [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 *token = getenv("S3_SESSION_TOKEN"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1155: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 *region = getenv("S3_REGION"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1156: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. const char *endpoint = getenv("S3_ENDPOINT"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1157:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *verify_ssl = getenv("S3_VERIFY_SSL"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1160:13: [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. keyid = getenv("AWS_ACCESS_KEY_ID"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1163: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. seckey = getenv("AWS_SECRET_ACCESS_KEY"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1166:13: [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. token = getenv("AWS_SESSION_TOKEN"); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1169: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. region = getenv("AWS_REGION"); data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_env.cc:23: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. const char *s = ::getenv(var_name); // On Mac, this may return an empty string data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_env.cc:30:7: [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. s = getenv(var_name); // On Linux, this may return an empty string data/dmlc-core-0.0~git20200912.bfad207/example/parameter.cc: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 name[256], val[256]; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/build_config_default.h:16: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). #define fopen64 std::fopen data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/concurrentqueue.h:1616:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (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 elements[sizeof(T) * BLOCK_SIZE]; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/filesystem.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 tmproot[MAX_PATH] = {0}; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/filesystem.h: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 tmpdir[MAX_PATH] = {0}; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/json.h:126: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 temp[64]; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/logging.h:328: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 buffer_[9]; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory_io.h:36:26: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (nread != 0) std::memcpy(ptr, p_buffer_ + curr_ptr_, nread); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory_io.h:43:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(p_buffer_ + curr_ptr_, ptr, size); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory_io.h:79:26: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (nread != 0) std::memcpy(ptr, &(*p_buffer_)[0] + curr_ptr_, nread); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/memory_io.h:88:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(&(*p_buffer_)[0] + curr_ptr_, ptr, size); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/optional.h:179: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 buf[4]; data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/strtonum.h:434:13: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). inline long atol(const char* p) { // NOLINT(*) data/dmlc-core-0.0~git20200912.bfad207/src/data/row_block.h:126:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(label) + size, batch.label, data/dmlc-core-0.0~git20200912.bfad207/src/data/row_block.h:157:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(value) + value.size() - ndata, batch.value, data/dmlc-core-0.0~git20200912.bfad207/src/io/indexed_recordio_split.cc:130:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(reinterpret_cast<char*>(out_rec->dptr) + out_rec->size, data/dmlc-core-0.0~git20200912.bfad207/src/io/input_split_base.cc:227:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, BeginPtr(overflow_), overflow_.length()); data/dmlc-core-0.0~git20200912.bfad207/src/io/input_split_base.cc:255:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(overflow_), bend, overflow_.length()); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:153:28: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). const int fname_length = MultiByteToWideChar(CP_UTF8, 0, path.name.c_str(), -1, nullptr, 0); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:157:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, path.name.c_str(), -1, &fname[0], fname_length); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:159:27: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). const int mode_length = MultiByteToWideChar(CP_UTF8, 0, mode, -1, nullptr, 0); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:161:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_UTF8, 0, mode, -1, &wmode[0], mode_length); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:180:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(fname, flag.c_str()); data/dmlc-core-0.0~git20200912.bfad207/src/io/local_filesys.cc:202:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen(fname, flag.c_str()); data/dmlc-core-0.0~git20200912.bfad207/src/io/recordio_split.cc:70:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(reinterpret_cast<char*>(out_rec->dptr) + out_rec->size, data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:89: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. unsigned char hash[SHA256_DIGEST_LENGTH]; data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:104: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 buf[sizeof "YYYYMMDDTHHMMSSZ"]; data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:116: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 buf[sizeof "YYYYMMDD"]; data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:384:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(*str) + len, buf, size); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:413:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, s->dptr, nread); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:515:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, BeginPtr(buffer_) + read_ptr_, nread); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:783:46: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). max_buffer_size_ = static_cast<size_t>(atol(buz)) << 20UL; data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:869:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(buffer_) + rlen, ptr, size); data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1077: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 errbuf[CURL_ERROR_SIZE]; data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:1126:41: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). info.size = static_cast<size_t>(atol(value.str().c_str())); data/dmlc-core-0.0~git20200912.bfad207/src/io/single_file_split.h:46: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). fp_ = fopen(fname, "rb"); data/dmlc-core-0.0~git20200912.bfad207/src/io/single_file_split.h:102:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, BeginPtr(overflow_), overflow_.length()); data/dmlc-core-0.0~git20200912.bfad207/src/io/single_file_split.h:120:14: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(overflow_), bend, overflow_.length()); data/dmlc-core-0.0~git20200912.bfad207/src/recordio.cc:78:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(*out_rec) + size, &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/src/recordio.cc:142:14: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(temp_) + tsize, data/dmlc-core-0.0~git20200912.bfad207/src/recordio.cc:150:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(temp_) + tsize, &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/test/csv_parser_test.cc:18:12: [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). fo = fopen(argv[5], "w"); data/dmlc-core-0.0~git20200912.bfad207/test/csv_parser_test.cc:24:38: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/csv_parser_test.cc:25:38: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/dataiter_test.cc:9: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 libsvm[10] = "libsvm"; data/dmlc-core-0.0~git20200912.bfad207/test/dataiter_test.cc:20: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). argv[1], atoi(argv[2]), atoi(argv[3]), format); data/dmlc-core-0.0~git20200912.bfad207/test/dataiter_test.cc:20:35: [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). argv[1], atoi(argv[2]), atoi(argv[3]), format); data/dmlc-core-0.0~git20200912.bfad207/test/filesys_test.cc: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 buf[32]; data/dmlc-core-0.0~git20200912.bfad207/test/filesys_test.cc: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 buf[32]; data/dmlc-core-0.0~git20200912.bfad207/test/libfm_parser_test.cc:14:42: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/libfm_parser_test.cc:15:42: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/libfm_parser_test.cc:17: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). int nthread = atoi(argv[4]); data/dmlc-core-0.0~git20200912.bfad207/test/libsvm_parser_test.cc:15:42: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/libsvm_parser_test.cc:16:42: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/libsvm_parser_test.cc:18: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). int nthread = atoi(argv[4]); data/dmlc-core-0.0~git20200912.bfad207/test/parameter_test.cc: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 name[256], val[256]; data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:13:26: [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). if (argc > 4) nsplit = atoi(argv[4]); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:15:15: [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). int ndata = atoi(argv[2]); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:16:14: [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). int dlen = atoi(argv[3]); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:30:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(s) + n, &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:33:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(s), &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:37:16: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(s) + 4, &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/test/recordio_test.cc:43:16: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(BeginPtr(s) + 4, &kMagic, sizeof(kMagic)); data/dmlc-core-0.0~git20200912.bfad207/test/split_read_test.cc:14:42: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/split_read_test.cc:15:42: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/split_repeat_read_test.cc:16:14: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/split_repeat_read_test.cc:17:14: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/split_repeat_read_test.cc:19:37: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). size_t nmax = static_cast<size_t>(atol(argv[4])); data/dmlc-core-0.0~git20200912.bfad207/test/split_test.cc:15:42: [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(argv[2]), data/dmlc-core-0.0~git20200912.bfad207/test/split_test.cc:16:42: [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(argv[3]), data/dmlc-core-0.0~git20200912.bfad207/test/stream_read_test.cc:14: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). skip_proc = atoi(argv[3]); data/dmlc-core-0.0~git20200912.bfad207/test/stream_read_test.cc:16:15: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). size_t sz = atol(argv[2]); data/dmlc-core-0.0~git20200912.bfad207/test/strtonum_test.cc:24:21: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). long v1 = dmlc::atol(l[i].c_str()); data/dmlc-core-0.0~git20200912.bfad207/test/strtonum_test.cc:25:20: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). long v2 = std::atol(l[i].c_str()); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/json.h:572:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void (*read)(JSONReader* reader, any *data); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/json.h:612:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). e.read(reader, data); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/optional.h:181:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). is.read(buf, 4); data/dmlc-core-0.0~git20200912.bfad207/include/dmlc/parameter.h:655:25: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. bool is_same = std::equal( data/dmlc-core-0.0~git20200912.bfad207/src/io/s3_filesys.cc:38: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). cend_ = content_ + strlen(content_); data/dmlc-core-0.0~git20200912.bfad207/test/unittest/unittest_thread_group.cc:40:10: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. return usleep(useconds); ANALYSIS SUMMARY: Hits = 104 Lines analyzed = 23992 in approximately 0.68 seconds (35302 lines/second) Physical Source Lines of Code (SLOC) = 16832 Hits@level = [0] 59 [1] 6 [2] 74 [3] 22 [4] 2 [5] 0 Hits@level+ = [0+] 163 [1+] 104 [2+] 98 [3+] 24 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 9.68394 [1+] 6.17871 [2+] 5.82224 [3+] 1.42586 [4+] 0.118821 [5+] 0 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.