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/cctz-2.3+dfsg1/examples/classic.cc Examining data/cctz-2.3+dfsg1/examples/epoch_shift.cc Examining data/cctz-2.3+dfsg1/examples/example1.cc Examining data/cctz-2.3+dfsg1/examples/example2.cc Examining data/cctz-2.3+dfsg1/examples/example3.cc Examining data/cctz-2.3+dfsg1/examples/example4.cc Examining data/cctz-2.3+dfsg1/examples/hello.cc Examining data/cctz-2.3+dfsg1/include/cctz/civil_time.h Examining data/cctz-2.3+dfsg1/include/cctz/civil_time_detail.h Examining data/cctz-2.3+dfsg1/include/cctz/time_zone.h Examining data/cctz-2.3+dfsg1/include/cctz/zone_info_source.h Examining data/cctz-2.3+dfsg1/src/civil_time_detail.cc Examining data/cctz-2.3+dfsg1/src/civil_time_test.cc Examining data/cctz-2.3+dfsg1/src/time_tool.cc Examining data/cctz-2.3+dfsg1/src/time_zone_fixed.cc Examining data/cctz-2.3+dfsg1/src/time_zone_fixed.h Examining data/cctz-2.3+dfsg1/src/time_zone_format.cc Examining data/cctz-2.3+dfsg1/src/time_zone_format_test.cc Examining data/cctz-2.3+dfsg1/src/time_zone_if.cc Examining data/cctz-2.3+dfsg1/src/time_zone_if.h Examining data/cctz-2.3+dfsg1/src/time_zone_impl.cc Examining data/cctz-2.3+dfsg1/src/time_zone_impl.h Examining data/cctz-2.3+dfsg1/src/time_zone_info.cc Examining data/cctz-2.3+dfsg1/src/time_zone_info.h Examining data/cctz-2.3+dfsg1/src/time_zone_libc.cc Examining data/cctz-2.3+dfsg1/src/time_zone_libc.h Examining data/cctz-2.3+dfsg1/src/time_zone_lookup.cc Examining data/cctz-2.3+dfsg1/src/time_zone_lookup_test.cc Examining data/cctz-2.3+dfsg1/src/time_zone_posix.cc Examining data/cctz-2.3+dfsg1/src/time_zone_posix.h Examining data/cctz-2.3+dfsg1/src/tzfile.h Examining data/cctz-2.3+dfsg1/src/zone_info_source.cc Examining data/cctz-2.3+dfsg1/src/cctz_benchmark.cc FINAL RESULTS: data/cctz-2.3+dfsg1/src/time_tool.cc:311:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(buf + 1, argv[i]); data/cctz-2.3+dfsg1/src/time_zone_fixed.cc:104:8: [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). std::strcpy(buf, kFixedOffsetPrefix); data/cctz-2.3+dfsg1/src/time_zone_info.cc:642: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. tzdir_env = std::getenv("TZDIR"); data/cctz-2.3+dfsg1/src/time_zone_lookup.cc:148: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. tz_env = std::getenv("TZ"); data/cctz-2.3+dfsg1/src/time_zone_lookup.cc:164: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. localtime_env = std::getenv("LOCALTIME"); data/cctz-2.3+dfsg1/src/time_zone_lookup_test.cc:1021: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* const ep = getenv("TZ"); data/cctz-2.3+dfsg1/examples/classic.cc:20: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[100]; data/cctz-2.3+dfsg1/examples/epoch_shift.cc:20: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[100]; data/cctz-2.3+dfsg1/src/time_zone_fixed.cc:103: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(kFixedOffsetPrefix) - 1 + sizeof("-24:00:00")]; data/cctz-2.3+dfsg1/src/time_zone_format.cc:299: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[3 + kDigits10_64]; // enough for longest conversion data/cctz-2.3+dfsg1/src/time_zone_info.cc:593: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). return fopen(path, mode); // TODO: Enable the close-on-exec flag. data/cctz-2.3+dfsg1/src/time_zone_info.cc:690: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 hbuf[24]; // covers header.zonetab_offset too data/cctz-2.3+dfsg1/src/time_zone_info.cc:700: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 ebuf[52]; // covers entry.unused too data/cctz-2.3+dfsg1/src/time_zone_lookup.cc:124: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 sysprop[PROP_VALUE_MAX]; data/cctz-2.3+dfsg1/src/tzfile.h:46:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_magic[4]; /* TZ_MAGIC */ data/cctz-2.3+dfsg1/src/tzfile.h:47:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */ data/cctz-2.3+dfsg1/src/tzfile.h:48:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_reserved[15]; /* reserved; must be zero */ data/cctz-2.3+dfsg1/src/tzfile.h:49:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ data/cctz-2.3+dfsg1/src/tzfile.h:50:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ data/cctz-2.3+dfsg1/src/tzfile.h:51:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_leapcnt[4]; /* coded number of leap seconds */ data/cctz-2.3+dfsg1/src/tzfile.h:52:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_timecnt[4]; /* coded number of transition times */ data/cctz-2.3+dfsg1/src/tzfile.h:53:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_typecnt[4]; /* coded number of local time types */ data/cctz-2.3+dfsg1/src/tzfile.h:54:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tzh_charcnt[4]; /* coded number of abbr. chars */ data/cctz-2.3+dfsg1/src/time_tool.cc:309:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char* buf = new char[strlen(argv[i] + 2)]; data/cctz-2.3+dfsg1/src/time_zone_fixed.cc:60:13: [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. if (!std::equal(kFixedOffsetPrefix, ep, name.begin())) data/cctz-2.3+dfsg1/src/time_zone_format.cc:52:25: [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). (input.eof() ? strlen(s) : static_cast<std::size_t>(input.tellg())); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 10573 in approximately 0.37 seconds (28717 lines/second) Physical Source Lines of Code (SLOC) = 7678 Hits@level = [0] 3 [1] 3 [2] 17 [3] 4 [4] 2 [5] 0 Hits@level+ = [0+] 29 [1+] 26 [2+] 23 [3+] 6 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 3.77703 [1+] 3.3863 [2+] 2.99557 [3+] 0.781454 [4+] 0.260485 [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.