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/protozero-1.7.0/include/protozero/basic_pbf_builder.hpp Examining data/protozero-1.7.0/include/protozero/basic_pbf_writer.hpp Examining data/protozero-1.7.0/include/protozero/buffer_fixed.hpp Examining data/protozero-1.7.0/include/protozero/buffer_string.hpp Examining data/protozero-1.7.0/include/protozero/buffer_tmpl.hpp Examining data/protozero-1.7.0/include/protozero/buffer_vector.hpp Examining data/protozero-1.7.0/include/protozero/byteswap.hpp Examining data/protozero-1.7.0/include/protozero/config.hpp Examining data/protozero-1.7.0/include/protozero/data_view.hpp Examining data/protozero-1.7.0/include/protozero/exception.hpp Examining data/protozero-1.7.0/include/protozero/iterators.hpp Examining data/protozero-1.7.0/include/protozero/pbf_builder.hpp Examining data/protozero-1.7.0/include/protozero/pbf_message.hpp Examining data/protozero-1.7.0/include/protozero/pbf_reader.hpp Examining data/protozero-1.7.0/include/protozero/pbf_writer.hpp Examining data/protozero-1.7.0/include/protozero/types.hpp Examining data/protozero-1.7.0/include/protozero/varint.hpp Examining data/protozero-1.7.0/include/protozero/version.hpp Examining data/protozero-1.7.0/test/catch/catch.hpp Examining data/protozero-1.7.0/test/include/buffer.hpp Examining data/protozero-1.7.0/test/include/packed_access.hpp Examining data/protozero-1.7.0/test/include/scalar_access.hpp Examining data/protozero-1.7.0/test/include/test.hpp Examining data/protozero-1.7.0/test/include/testcase.hpp Examining data/protozero-1.7.0/test/reader_tests.cpp Examining data/protozero-1.7.0/test/t/alignment/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/bool/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/bool/testcase.cpp Examining data/protozero-1.7.0/test/t/bool/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/bytes/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/bytes/testcase.cpp Examining data/protozero-1.7.0/test/t/bytes/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/complex/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/complex/testcase.cpp Examining data/protozero-1.7.0/test/t/double/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/double/testcase.cpp Examining data/protozero-1.7.0/test/t/double/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/enum/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/enum/testcase.cpp Examining data/protozero-1.7.0/test/t/enum/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/fixed32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/fixed32/testcase.cpp Examining data/protozero-1.7.0/test/t/fixed32/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/fixed64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/fixed64/testcase.cpp Examining data/protozero-1.7.0/test/t/float/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/float/testcase.cpp Examining data/protozero-1.7.0/test/t/int32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/int32/testcase.cpp Examining data/protozero-1.7.0/test/t/int32/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/int64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/int64/testcase.cpp Examining data/protozero-1.7.0/test/t/message/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/message/testcase.cpp Examining data/protozero-1.7.0/test/t/message/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/nested/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/nested/testcase.cpp Examining data/protozero-1.7.0/test/t/nested/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_bool/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_bool/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_double/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_double/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_enum/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_enum/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_fixed32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_fixed32/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_fixed32/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_fixed64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_fixed64/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_float/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_float/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_int32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_int32/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_int64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_int64/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sfixed32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sfixed32/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sfixed64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sfixed64/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sint32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sint32/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sint64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_sint64/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_uint32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_uint32/testcase.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_uint64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/repeated_packed_uint64/testcase.cpp Examining data/protozero-1.7.0/test/t/rollback/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/sfixed32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/sfixed32/testcase.cpp Examining data/protozero-1.7.0/test/t/sfixed64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/sfixed64/testcase.cpp Examining data/protozero-1.7.0/test/t/sint32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/sint32/testcase.cpp Examining data/protozero-1.7.0/test/t/sint64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/sint64/testcase.cpp Examining data/protozero-1.7.0/test/t/skip/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/string/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/string/testcase.cpp Examining data/protozero-1.7.0/test/t/string/writer_test_cases.cpp Examining data/protozero-1.7.0/test/t/tag_and_type/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/tag_and_type/testcase.cpp Examining data/protozero-1.7.0/test/t/tags/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/tags/testcase.cpp Examining data/protozero-1.7.0/test/t/uint32/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/uint32/testcase.cpp Examining data/protozero-1.7.0/test/t/uint64/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/uint64/testcase.cpp Examining data/protozero-1.7.0/test/t/vector_tile/reader_test_cases.cpp Examining data/protozero-1.7.0/test/t/wrong_type_access/reader_test_cases.cpp Examining data/protozero-1.7.0/test/unit/main.cpp Examining data/protozero-1.7.0/test/unit/test_basic.cpp Examining data/protozero-1.7.0/test/unit/test_buffer.cpp Examining data/protozero-1.7.0/test/unit/test_data_view.cpp Examining data/protozero-1.7.0/test/unit/test_endian.cpp Examining data/protozero-1.7.0/test/unit/test_exceptions.cpp Examining data/protozero-1.7.0/test/unit/test_iterators.cpp Examining data/protozero-1.7.0/test/unit/test_varint.cpp Examining data/protozero-1.7.0/test/unit/test_zigzag.cpp Examining data/protozero-1.7.0/test/writer_tests.cpp Examining data/protozero-1.7.0/tools/pbf-decoder.cpp FINAL RESULTS: data/protozero-1.7.0/test/catch/catch.hpp:4638:1: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random(T a, T b) { data/protozero-1.7.0/test/catch/catch.hpp:4647:1: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random(T a, T b) { data/protozero-1.7.0/test/catch/catch.hpp:12977:18: [3] (random) srand: 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. std::srand(config.rngSeed()); data/protozero-1.7.0/test/reader_tests.cpp:12:34: [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* tests_dir = std::getenv("TESTS_DIR"); data/protozero-1.7.0/tools/pbf-decoder.cpp:218:23: [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. const int c = getopt_long(argc, argv, "hl:o:", long_options, nullptr); data/protozero-1.7.0/include/protozero/iterators.hpp:191: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(&result, m_data, sizeof(value_type)); data/protozero-1.7.0/include/protozero/pbf_reader.hpp:81: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(&result, data, sizeof(T)); data/protozero-1.7.0/test/catch/catch.hpp:2155:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char timeStamp[timeStampSize]; data/protozero-1.7.0/test/catch/catch.hpp:4450:29: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. alignas(alignof(T)) char storage[sizeof(T)]; data/protozero-1.7.0/test/catch/catch.hpp:5946:16: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (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 line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; data/protozero-1.7.0/test/catch/catch.hpp:7559:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open(); data/protozero-1.7.0/test/catch/catch.hpp:11392: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(&i, &f, sizeof(f)); data/protozero-1.7.0/test/catch/catch.hpp:11399: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(&i, &d, sizeof(d)); data/protozero-1.7.0/test/catch/catch.hpp:11923:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char m_buffer[L_tmpnam] = { 0 }; data/protozero-1.7.0/test/catch/catch.hpp:12010:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[100]; data/protozero-1.7.0/test/catch/catch.hpp:12019:23: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). m_file = std::tmpfile(); data/protozero-1.7.0/test/catch/catch.hpp:12043:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[100] = {}; data/protozero-1.7.0/test/catch/catch.hpp:12506:30: [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). tracker->open(); data/protozero-1.7.0/test/catch/catch.hpp:13306:31: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (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 **utf8Argv = new char *[ argc ]; data/protozero-1.7.0/test/catch/catch.hpp:13465:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char data[bufferSize]; data/protozero-1.7.0/test/catch/catch.hpp:13514:23: [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). m_ofs.open( filename.c_str() ); data/protozero-1.7.0/test/catch/catch.hpp:14268:23: [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). void TrackerBase::open() { data/protozero-1.7.0/test/catch/catch.hpp:14368:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). open(); data/protozero-1.7.0/test/catch/catch.hpp:15552:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[maxDoubleSize]; data/protozero-1.7.0/test/catch/catch.hpp:15559:14: [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. std::sprintf(buffer, "%.3f", duration); data/protozero-1.7.0/test/catch/catch.hpp:16148:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open() { data/protozero-1.7.0/test/catch/catch.hpp:16182:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). tp.open(); data/protozero-1.7.0/test/catch/catch.hpp:16585:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char timeStamp[timeStampSize]; data/protozero-1.7.0/test/unit/test_basic.cpp:52:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1]; data/protozero-1.7.0/test/unit/test_basic.cpp:64: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 buffer[1] = {1U << 3U | 7U}; data/protozero-1.7.0/test/unit/test_varint.cpp:194: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[1]; data/protozero-1.7.0/test/unit/test_varint.cpp:214: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[1]; data/protozero-1.7.0/include/protozero/basic_pbf_writer.hpp:576:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). add_bytes(tag, value, std::strlen(value)); data/protozero-1.7.0/include/protozero/basic_pbf_writer.hpp:649:36: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). add_bytes(tag, value, std::strlen(value)); data/protozero-1.7.0/include/protozero/data_view.hpp:79:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). m_size{std::strlen(ptr)} { data/protozero-1.7.0/include/protozero/data_view.hpp:178:17: [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. std::equal(lhs.data(), lhs.data() + lhs.size(), rhs.data()); data/protozero-1.7.0/test/catch/catch.hpp:3722:29: [1] (buffer) is_permutation: 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. return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); data/protozero-1.7.0/test/catch/catch.hpp:13335:36: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static_cast<void>(std::getchar()); data/protozero-1.7.0/test/catch/catch.hpp:13340:36: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static_cast<void>(std::getchar()); data/protozero-1.7.0/test/catch/catch.hpp:13637:50: [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. return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); data/protozero-1.7.0/test/catch/catch.hpp:13643:50: [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. return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); data/protozero-1.7.0/test/catch/catch.hpp:13731:67: [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). : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) data/protozero-1.7.0/test/unit/test_buffer.cpp:31:18: [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. REQUIRE(std::equal(bc::at_pos(buffer, 0), data/protozero-1.7.0/test/unit/test_buffer.cpp:39:18: [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. REQUIRE(std::equal(bc::at_pos(buffer, 0), data/protozero-1.7.0/test/unit/test_buffer.cpp:43:18: [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. REQUIRE(std::equal(buffer->cbegin(), buffer->cend(), "abc ghi jkl xy")); ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 28391 in approximately 0.62 seconds (45579 lines/second) Physical Source Lines of Code (SLOC) = 20086 Hits@level = [0] 0 [1] 13 [2] 27 [3] 5 [4] 0 [5] 0 Hits@level+ = [0+] 45 [1+] 45 [2+] 32 [3+] 5 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 2.24037 [1+] 2.24037 [2+] 1.59315 [3+] 0.24893 [4+] 0 [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.