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/libept-1.2/ept/apt/apt-test.cc Examining data/libept-1.2/ept/apt/apt.cc Examining data/libept-1.2/ept/apt/apt.h Examining data/libept-1.2/ept/apt/packagerecord-test.cc Examining data/libept-1.2/ept/apt/packagerecord.cc Examining data/libept-1.2/ept/apt/packagerecord.h Examining data/libept-1.2/ept/apt/recordparser-test.cc Examining data/libept-1.2/ept/apt/recordparser.cc Examining data/libept-1.2/ept/apt/recordparser.h Examining data/libept-1.2/ept/apt/version-test.cc Examining data/libept-1.2/ept/apt/version.cc Examining data/libept-1.2/ept/apt/version.h Examining data/libept-1.2/ept/axi/axi-test.cc Examining data/libept-1.2/ept/axi/axi.cc Examining data/libept-1.2/ept/axi/axi.h Examining data/libept-1.2/ept/debtags/coll/TextFormat.cc Examining data/libept-1.2/ept/debtags/coll/TextFormat.h Examining data/libept-1.2/ept/debtags/coll/fast.cc Examining data/libept-1.2/ept/debtags/coll/fast.h Examining data/libept-1.2/ept/debtags/coll/operators.h Examining data/libept-1.2/ept/debtags/coll/set.h Examining data/libept-1.2/ept/debtags/debtags-test.cc Examining data/libept-1.2/ept/debtags/debtags.cc Examining data/libept-1.2/ept/debtags/debtags.h Examining data/libept-1.2/ept/debtags/maint/debdbparser.cc Examining data/libept-1.2/ept/debtags/maint/debdbparser.h Examining data/libept-1.2/ept/debtags/vocabulary-test.cc Examining data/libept-1.2/ept/debtags/vocabulary.cc Examining data/libept-1.2/ept/debtags/vocabulary.h Examining data/libept-1.2/ept/intro.doc.h Examining data/libept-1.2/ept/progresscallback.cpp Examining data/libept-1.2/ept/progresscallback.h Examining data/libept-1.2/ept/test.cpp Examining data/libept-1.2/ept/test.h Examining data/libept-1.2/ept/utils/string.cc Examining data/libept-1.2/ept/utils/string.h Examining data/libept-1.2/ept/utils/sys.cc Examining data/libept-1.2/ept/utils/sys.h Examining data/libept-1.2/ept/utils/tests-main.cc Examining data/libept-1.2/ept/utils/tests.cc Examining data/libept-1.2/ept/utils/tests.h Examining data/libept-1.2/tools/ept-cat.cpp Examining data/libept-1.2/tools/pkglist.cpp FINAL RESULTS: data/libept-1.2/ept/utils/sys.cc:143:6: [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. bool access(const std::string &s, int m) data/libept-1.2/ept/utils/sys.cc:145:14: [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. return ::access(s.c_str(), m) == 0; data/libept-1.2/ept/utils/sys.cc:150:17: [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. return sys::access(file, F_OK); data/libept-1.2/ept/utils/sys.cc:757:18: [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 (sys::access(candidate, X_OK)) data/libept-1.2/ept/utils/sys.cc:786: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( _tmpl, tmpl.c_str() ); data/libept-1.2/ept/utils/sys.h:80:6: [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. bool access(const std::string& s, int m); data/libept-1.2/ept/debtags/debtags.cc:79: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* res = getenv("DEBTAGS_TAGS"); data/libept-1.2/ept/debtags/vocabulary.cc:107: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* res = getenv("DEBTAGS_VOCABULARY"); data/libept-1.2/ept/test.h:25:27: [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* old = getenv(name); data/libept-1.2/ept/utils/sys.cc:750: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* path = getenv("PATH"); data/libept-1.2/ept/utils/tests-main.cc:71: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. if (const char* whitelist = getenv("TEST_WHITELIST")) data/libept-1.2/ept/utils/tests-main.cc:74: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. if (const char* blacklist = getenv("TEST_BLACKLIST")) data/libept-1.2/ept/apt/apt.cc:288: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[vflist[idx]->Size + slack + 1]; data/libept-1.2/ept/debtags/debtags.cc:60: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(pathname.c_str(), "rt"); data/libept-1.2/ept/debtags/vocabulary.cc:116: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(pathname.c_str(), "rt"); data/libept-1.2/ept/utils/string.cc:263: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 buf[5]; data/libept-1.2/ept/utils/string.cc:290: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 buf[5] = "0x\0\0"; data/libept-1.2/ept/utils/string.cc:295:44: [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). res += (char)atoi(buf); data/libept-1.2/ept/utils/string.cc:321: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 buf[4]; data/libept-1.2/ept/utils/sys.cc:319:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(pathname, flags | O_PATH); data/libept-1.2/ept/utils/sys.cc:327:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(pathname.c_str(), flags | O_PATH); data/libept-1.2/ept/utils/sys.cc:577:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(pathname.c_str(), flags, mode); data/libept-1.2/ept/utils/sys.cc:587:12: [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). File File::mkstemp(const std::string& prefix) data/libept-1.2/ept/utils/sys.cc:590: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(fbuf, prefix.data(), prefix.size()); data/libept-1.2/ept/utils/sys.cc:591: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(fbuf + prefix.size(), "XXXXXX", 7); data/libept-1.2/ept/utils/sys.cc:592:16: [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). int fd = ::mkstemp(fbuf); data/libept-1.2/ept/utils/sys.cc:621:22: [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). File out = File::mkstemp(file); data/libept-1.2/ept/utils/sys.h:331:17: [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). static File mkstemp(const std::string& prefix); data/libept-1.2/ept/utils/tests-main.cc:58:44: [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). tut::runner.get().run_test(argv[1],::atoi(argv[2])); data/libept-1.2/ept/debtags/coll/TextFormat.cc:54:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF) data/libept-1.2/ept/debtags/maint/debdbparser.cc:35:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF && (isblank(c) || c == '\n')) data/libept-1.2/ept/debtags/maint/debdbparser.cc:65:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF && (isalnum(c) || c == '-')) data/libept-1.2/ept/debtags/maint/debdbparser.cc:87:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF && isblank(c)) data/libept-1.2/ept/debtags/maint/debdbparser.cc:110:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF && isblank(c)) data/libept-1.2/ept/debtags/maint/debdbparser.cc:114:40: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for ( ; c != EOF && c != '\n'; c = getc(in)) data/libept-1.2/ept/debtags/vocabulary.cc:121:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(in, pathname); data/libept-1.2/ept/debtags/vocabulary.cc:218:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void Vocabulary::read(FILE* input, const std::string& pathname) data/libept-1.2/ept/debtags/vocabulary.cc:265:25: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t prev_umask = umask(022); data/libept-1.2/ept/debtags/vocabulary.cc:267:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(prev_umask); data/libept-1.2/ept/debtags/vocabulary.h:237:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(FILE* input, const std::string& pathname); data/libept-1.2/ept/utils/sys.cc:624:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t mask = umask(0777); data/libept-1.2/ept/utils/sys.cc:625:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(mask); ANALYSIS SUMMARY: Hits = 42 Lines analyzed = 8657 in approximately 0.30 seconds (29046 lines/second) Physical Source Lines of Code (SLOC) = 5625 Hits@level = [0] 15 [1] 13 [2] 17 [3] 6 [4] 6 [5] 0 Hits@level+ = [0+] 57 [1+] 42 [2+] 29 [3+] 12 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 10.1333 [1+] 7.46667 [2+] 5.15556 [3+] 2.13333 [4+] 1.06667 [5+] 0 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.