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/pstreams-1.0.1/pstream.h Examining data/pstreams-1.0.1/test_pstreams.cc Examining data/pstreams-1.0.1/test_minimum.cc Examining data/pstreams-1.0.1/debian/tests/bad-manpage.cc Examining data/pstreams-1.0.1/debian/tests/sed.cc Examining data/pstreams-1.0.1/debian/tests/simple.cc FINAL RESULTS: data/pstreams-1.0.1/pstream.h:1116:13: [4] (shell) execl: 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. ::execl(shell_path, "sh", "-c", command.c_str(), (char*)NULL); data/pstreams-1.0.1/pstream.h:1240:17: [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. ::execvp(file.c_str(), arg_v); data/pstreams-1.0.1/pstream.h:2102:15: [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. this->setstate(std::ios_base::failbit); data/pstreams-1.0.1/pstream.h:2121:15: [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. this->setstate(std::ios_base::failbit); data/pstreams-1.0.1/pstream.h:2130:15: [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. this->setstate(std::ios_base::failbit); data/pstreams-1.0.1/pstream.h:119: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). open(const std::string& cmd, pmode mode); data/pstreams-1.0.1/pstream.h:123: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). open(const std::string& file, const argv_type& argv, pmode mode); data/pstreams-1.0.1/pstream.h:156:7: [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). fopen(FILE*& in, FILE*& out, FILE*& err); data/pstreams-1.0.1/pstream.h:316:7: [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). fopen(FILE*& in, FILE*& out, FILE*& err); data/pstreams-1.0.1/pstream.h:439: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). open(const std::string& cmd, pmode mode = pstdout) data/pstreams-1.0.1/pstream.h:455: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). open( const std::string& file, data/pstreams-1.0.1/pstream.h:597: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). open(const std::string& cmd, pmode mode = pstdin) data/pstreams-1.0.1/pstream.h:613: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). open( const std::string& file, data/pstreams-1.0.1/pstream.h:737: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). open(const std::string& cmd, pmode mode = pstdout|pstdin) data/pstreams-1.0.1/pstream.h:753: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). open( const std::string& file, data/pstreams-1.0.1/pstream.h:906: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). open(const std::string& cmd, pmode mode = pstdout|pstdin) data/pstreams-1.0.1/pstream.h:922: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). open( const std::string& file, data/pstreams-1.0.1/pstream.h:1033: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). open(cmd, mode); data/pstreams-1.0.1/pstream.h:1058: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). open(file, argv, mode); data/pstreams-1.0.1/pstream.h:1101:28: [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). basic_pstreambuf<C,T>::open(const std::string& command, pmode mode) data/pstreams-1.0.1/pstream.h:1106:20: [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). return this->open(shell_path, argv_type(argv, argv+3), mode); data/pstreams-1.0.1/pstream.h:1203:28: [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). basic_pstreambuf<C,T>::open( const std::string& file, data/pstreams-1.0.1/pstream.h:2101:17: [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 (!buf_.open((command_=cmd), mode)) data/pstreams-1.0.1/pstream.h:2120:17: [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 (!buf_.open((command_=file), argv, mode)) data/pstreams-1.0.1/pstream.h:2197:28: [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). basic_pstreambuf<C,T>::fopen(FILE*& in, FILE*& out, FILE*& err) data/pstreams-1.0.1/pstream.h:2237:26: [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). pstream_common<C,T>::fopen(FILE*& fin, FILE*& fout, FILE*& ferr) data/pstreams-1.0.1/pstream.h:2239:19: [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 buf_.fopen(fin, fout, ferr); data/pstreams-1.0.1/test_pstreams.cc:280: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). os.open("sed 's/^/STDIN: /'"); data/pstreams-1.0.1/test_pstreams.cc:288: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). is.open("hostname"); data/pstreams-1.0.1/test_pstreams.cc:298: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). host.open("hostname"); data/pstreams-1.0.1/test_pstreams.cc:421: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). ps.open(cmd); data/pstreams-1.0.1/test_pstreams.cc:431: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). ps.open(cmd); data/pstreams-1.0.1/test_pstreams.cc:522:11: [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). s.open(cmd); data/pstreams-1.0.1/test_pstreams.cc:535:11: [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). s.open(cmd); data/pstreams-1.0.1/test_pstreams.cc:664: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). in.open("echo 'abc'", pstreambuf::pstdout); data/pstreams-1.0.1/test_pstreams.cc:672: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). in.open("echo 'abc' >&2", pstreambuf::pstderr); data/pstreams-1.0.1/test_pstreams.cc:687:25: [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). size_t res = os.fopen(in, out, err); data/pstreams-1.0.1/test_pstreams.cc:699:25: [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). size_t res = is.fopen(in, out, err); data/pstreams-1.0.1/test_pstreams.cc:706: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 buf[len]; data/pstreams-1.0.1/test_pstreams.cc:720:25: [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). size_t res = ps.fopen(in, out, err); data/pstreams-1.0.1/test_pstreams.cc:731: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 buf[len]; data/pstreams-1.0.1/test_pstreams.cc:774:11: [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). p.open(argv[0], argv, all3streams); data/pstreams-1.0.1/test_pstreams.cc:780:11: [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). p.open(argv[0], all3streams); data/pstreams-1.0.1/test_pstreams.cc:812: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). in.open(argv[0], argv); data/pstreams-1.0.1/test_pstreams.cc:839: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). in.open("echo sleeping && sleep 5"); data/pstreams-1.0.1/pstream.h:194:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(char_type* s, std::streamsize n); data/pstreams-1.0.1/pstream.h:1268:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch (::read(ck_exec[RD], &error_, sizeof(error_))) data/pstreams-1.0.1/pstream.h:1903:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(rbuf + pbsz, bufsz - pbsz); data/pstreams-1.0.1/pstream.h:1915:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(rbuf + pbsz, bufsz - pbsz); data/pstreams-1.0.1/pstream.h:1963:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). basic_pstreambuf<C,T>::read(char_type* s, std::streamsize n) data/pstreams-1.0.1/pstream.h:1968:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = ::read(rpipe(), s, n * sizeof(char_type)); data/pstreams-1.0.1/test_pstreams.cc:546:43: [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). print_result(in, size_t(avail) == strlen("this is ")); ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 3252 in approximately 0.10 seconds (33606 lines/second) Physical Source Lines of Code (SLOC) = 1912 Hits@level = [0] 0 [1] 7 [2] 40 [3] 3 [4] 2 [5] 0 Hits@level+ = [0+] 52 [1+] 52 [2+] 45 [3+] 5 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 27.1967 [1+] 27.1967 [2+] 23.5356 [3+] 2.61506 [4+] 1.04603 [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.