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/clog-1.3.0/cmake.h Examining data/clog-1.3.0/src/clog.cpp Examining data/clog-1.3.0/src/libshared/src/Args.cpp Examining data/clog-1.3.0/src/libshared/src/Args.h Examining data/clog-1.3.0/src/libshared/src/Color.cpp Examining data/clog-1.3.0/src/libshared/src/Color.h Examining data/clog-1.3.0/src/libshared/src/Composite.cpp Examining data/clog-1.3.0/src/libshared/src/Composite.h Examining data/clog-1.3.0/src/libshared/src/Configuration.cpp Examining data/clog-1.3.0/src/libshared/src/Configuration.h Examining data/clog-1.3.0/src/libshared/src/Datetime.cpp Examining data/clog-1.3.0/src/libshared/src/Datetime.h Examining data/clog-1.3.0/src/libshared/src/Duration.cpp Examining data/clog-1.3.0/src/libshared/src/Duration.h Examining data/clog-1.3.0/src/libshared/src/format.cpp Examining data/clog-1.3.0/src/libshared/src/format.h Examining data/clog-1.3.0/src/libshared/src/FS.cpp Examining data/clog-1.3.0/src/libshared/src/FS.h Examining data/clog-1.3.0/src/libshared/src/JSON.cpp Examining data/clog-1.3.0/src/libshared/src/JSON.h Examining data/clog-1.3.0/src/libshared/src/JSON2.cpp Examining data/clog-1.3.0/src/libshared/src/JSON2.h Examining data/clog-1.3.0/src/libshared/src/Lexer.cpp Examining data/clog-1.3.0/src/libshared/src/Lexer.h Examining data/clog-1.3.0/src/libshared/src/Log.cpp Examining data/clog-1.3.0/src/libshared/src/Log.h Examining data/clog-1.3.0/src/libshared/src/Msg.cpp Examining data/clog-1.3.0/src/libshared/src/Msg.h Examining data/clog-1.3.0/src/libshared/src/Palette.cpp Examining data/clog-1.3.0/src/libshared/src/Palette.h Examining data/clog-1.3.0/src/libshared/src/Pig.cpp Examining data/clog-1.3.0/src/libshared/src/Pig.h Examining data/clog-1.3.0/src/libshared/src/RX.cpp Examining data/clog-1.3.0/src/libshared/src/RX.h Examining data/clog-1.3.0/src/libshared/src/shared.cpp Examining data/clog-1.3.0/src/libshared/src/shared.h Examining data/clog-1.3.0/src/libshared/src/Table.cpp Examining data/clog-1.3.0/src/libshared/src/Table.h Examining data/clog-1.3.0/src/libshared/src/Timer.cpp Examining data/clog-1.3.0/src/libshared/src/Timer.h Examining data/clog-1.3.0/src/libshared/src/unicode.cpp Examining data/clog-1.3.0/src/libshared/src/unicode.h Examining data/clog-1.3.0/src/libshared/src/utf8.cpp Examining data/clog-1.3.0/src/libshared/src/utf8.h Examining data/clog-1.3.0/src/libshared/src/wcwidth6.cpp Examining data/clog-1.3.0/src/Rule.cpp Examining data/clog-1.3.0/src/Rule.h FINAL RESULTS: data/clog-1.3.0/src/libshared/src/FS.cpp:640:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod (full_name.c_str (), mode); data/clog-1.3.0/src/libshared/src/FS.cpp:156:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access (_data.c_str (), F_OK) ? false : true; data/clog-1.3.0/src/libshared/src/FS.cpp:193:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access (_data.c_str (), R_OK) ? false : true; data/clog-1.3.0/src/libshared/src/FS.cpp:199:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access (_data.c_str (), W_OK) ? false : true; data/clog-1.3.0/src/libshared/src/FS.cpp:205:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access (_data.c_str (), X_OK) ? false : true; data/clog-1.3.0/src/libshared/src/FS.cpp:757:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (! access (from.c_str (), F_OK)) data/clog-1.3.0/src/libshared/src/shared.cpp:522:12: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. _exit (execvp (executable.c_str (), argv)); data/clog-1.3.0/src/libshared/src/FS.cpp:239: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 *home = getenv("HOME"); data/clog-1.3.0/src/libshared/src/Datetime.cpp:2623: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 weekStr[3]; data/clog-1.3.0/src/libshared/src/FS.cpp:357:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (open ()) data/clog-1.3.0/src/libshared/src/FS.cpp:385: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). bool File::open () data/clog-1.3.0/src/libshared/src/FS.cpp:396: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). _fh = fopen (_data.c_str (), (already_exists ? "r+" : "w+")); data/clog-1.3.0/src/libshared/src/FS.cpp:518:5: [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/clog-1.3.0/src/libshared/src/FS.cpp:532:5: [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/clog-1.3.0/src/libshared/src/FS.cpp:546:5: [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/clog-1.3.0/src/libshared/src/FS.cpp:556:5: [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/clog-1.3.0/src/libshared/src/FS.cpp:898: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[PATH_MAX]; data/clog-1.3.0/src/libshared/src/FS.h:82:8: [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). bool open (); data/clog-1.3.0/src/libshared/src/RX.cpp:89: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 message[256]; data/clog-1.3.0/src/libshared/src/shared.cpp:483: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[16384]; data/clog-1.3.0/src/libshared/src/utf8.cpp:114: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 sequence[5] {}; data/clog-1.3.0/src/libshared/src/Configuration.cpp:44:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). File::read (file, contents); data/clog-1.3.0/src/libshared/src/Configuration.cpp:89:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). File::read (file, contents); data/clog-1.3.0/src/libshared/src/Configuration.cpp:143:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (File::read (file, contents) && contents.length ()) data/clog-1.3.0/src/libshared/src/Configuration.cpp:167:11: [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 (equal != std::string::npos) data/clog-1.3.0/src/libshared/src/Configuration.cpp:169:51: [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::string key = trim (line.substr (0, equal)); data/clog-1.3.0/src/libshared/src/Configuration.cpp:170:74: [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::string value = trim (line.substr (equal+1, line.length () - equal)); data/clog-1.3.0/src/libshared/src/FS.cpp:458:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void File::read (std::string& contents) data/clog-1.3.0/src/libshared/src/FS.cpp:487:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void File::read (std::vector <std::string>& contents) data/clog-1.3.0/src/libshared/src/FS.cpp:648:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool File::read (const std::string& name, std::string& contents) data/clog-1.3.0/src/libshared/src/FS.cpp:678:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool File::read (const std::string& name, std::vector <std::string>& contents) data/clog-1.3.0/src/libshared/src/FS.h:88:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read (std::string&); data/clog-1.3.0/src/libshared/src/FS.h:89:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read (std::vector <std::string>&); data/clog-1.3.0/src/libshared/src/FS.h:104:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static bool read (const std::string&, std::string&); data/clog-1.3.0/src/libshared/src/FS.h:105:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static bool read (const std::string&, std::vector <std::string>&); data/clog-1.3.0/src/libshared/src/shared.cpp:589:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_retval = read (pout[0], &buf, sizeof (buf) - 1); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 12903 in approximately 0.32 seconds (40501 lines/second) Physical Source Lines of Code (SLOC) = 8677 Hits@level = [0] 0 [1] 15 [2] 13 [3] 1 [4] 6 [5] 1 Hits@level+ = [0+] 36 [1+] 36 [2+] 21 [3+] 8 [4+] 7 [5+] 1 Hits/KSLOC@level+ = [0+] 4.1489 [1+] 4.1489 [2+] 2.42019 [3+] 0.921978 [4+] 0.80673 [5+] 0.115247 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.