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/pepper-0.3.3/src/3rdparty/lunar/lunar.h Examining data/pepper-0.3.3/src/abstractcache.cpp Examining data/pepper-0.3.3/src/abstractcache.h Examining data/pepper-0.3.3/src/backend.cpp Examining data/pepper-0.3.3/src/backend.h Examining data/pepper-0.3.3/src/backends/git.cpp Examining data/pepper-0.3.3/src/backends/git.h Examining data/pepper-0.3.3/src/backends/mercurial.cpp Examining data/pepper-0.3.3/src/backends/mercurial.h Examining data/pepper-0.3.3/src/backends/subversion.cpp Examining data/pepper-0.3.3/src/backends/subversion.h Examining data/pepper-0.3.3/src/backends/subversion_delta.cpp Examining data/pepper-0.3.3/src/backends/subversion_p.h Examining data/pepper-0.3.3/src/bstream.cpp Examining data/pepper-0.3.3/src/bstream.h Examining data/pepper-0.3.3/src/cache.cpp Examining data/pepper-0.3.3/src/cache.h Examining data/pepper-0.3.3/src/diffstat.cpp Examining data/pepper-0.3.3/src/diffstat.h Examining data/pepper-0.3.3/src/gnuplot.cpp Examining data/pepper-0.3.3/src/gnuplot.h Examining data/pepper-0.3.3/src/jobqueue.h Examining data/pepper-0.3.3/src/ldbcache.cpp Examining data/pepper-0.3.3/src/ldbcache.h Examining data/pepper-0.3.3/src/logger.cpp Examining data/pepper-0.3.3/src/logger.h Examining data/pepper-0.3.3/src/luahelpers.h Examining data/pepper-0.3.3/src/luamodules.cpp Examining data/pepper-0.3.3/src/luamodules.h Examining data/pepper-0.3.3/src/main.cpp Examining data/pepper-0.3.3/src/main.h Examining data/pepper-0.3.3/src/options.cpp Examining data/pepper-0.3.3/src/options.h Examining data/pepper-0.3.3/src/pex.cpp Examining data/pepper-0.3.3/src/pex.h Examining data/pepper-0.3.3/src/plot.cpp Examining data/pepper-0.3.3/src/plot.h Examining data/pepper-0.3.3/src/report.cpp Examining data/pepper-0.3.3/src/report.h Examining data/pepper-0.3.3/src/repository.cpp Examining data/pepper-0.3.3/src/repository.h Examining data/pepper-0.3.3/src/revision.cpp Examining data/pepper-0.3.3/src/revision.h Examining data/pepper-0.3.3/src/revisioniterator.cpp Examining data/pepper-0.3.3/src/revisioniterator.h Examining data/pepper-0.3.3/src/strlib.cpp Examining data/pepper-0.3.3/src/strlib.h Examining data/pepper-0.3.3/src/syslib/datetime.cpp Examining data/pepper-0.3.3/src/syslib/datetime.h Examining data/pepper-0.3.3/src/syslib/fs.cpp Examining data/pepper-0.3.3/src/syslib/fs.h Examining data/pepper-0.3.3/src/syslib/io.cpp Examining data/pepper-0.3.3/src/syslib/io.h Examining data/pepper-0.3.3/src/syslib/parallel.cpp Examining data/pepper-0.3.3/src/syslib/parallel.h Examining data/pepper-0.3.3/src/syslib/sigblock.cpp Examining data/pepper-0.3.3/src/syslib/sigblock.h Examining data/pepper-0.3.3/src/tag.cpp Examining data/pepper-0.3.3/src/tag.h Examining data/pepper-0.3.3/src/utils.cpp Examining data/pepper-0.3.3/src/utils.h Examining data/pepper-0.3.3/tests/backends/main.cpp Examining data/pepper-0.3.3/tests/backends/test_subversion.h Examining data/pepper-0.3.3/tests/catch/catch.hpp Examining data/pepper-0.3.3/tests/catch/catch_reporter_basic.hpp Examining data/pepper-0.3.3/tests/catch/catch_reporter_junit.hpp Examining data/pepper-0.3.3/tests/catch/catch_reporter_xml.hpp Examining data/pepper-0.3.3/tests/catch/catch_runner.hpp Examining data/pepper-0.3.3/tests/catch/catch_with_main.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_capture.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_commandline.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_common.h Examining data/pepper-0.3.3/tests/catch/internal/catch_config.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_debugger.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_generators.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_generators_impl.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_hub.h Examining data/pepper-0.3.3/tests/catch/internal/catch_hub_impl.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_interfaces_capture.h Examining data/pepper-0.3.3/tests/catch/internal/catch_interfaces_reporter.h Examining data/pepper-0.3.3/tests/catch/internal/catch_interfaces_runner.h Examining data/pepper-0.3.3/tests/catch/internal/catch_interfaces_testcase.h Examining data/pepper-0.3.3/tests/catch/internal/catch_list.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_reporter_registrars.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_reporter_registry.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_result_type.h Examining data/pepper-0.3.3/tests/catch/internal/catch_resultinfo.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_runner_impl.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_section.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_self_test.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_stream.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_test_case_info.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_test_case_registry_impl.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_test_registry.hpp Examining data/pepper-0.3.3/tests/catch/internal/catch_xmlwriter.hpp Examining data/pepper-0.3.3/tests/diffstat/main.cpp Examining data/pepper-0.3.3/tests/units/main.cpp Examining data/pepper-0.3.3/tests/units/test_bstream.h Examining data/pepper-0.3.3/tests/units/test_options.h Examining data/pepper-0.3.3/tests/units/test_parallel.h Examining data/pepper-0.3.3/tests/units/test_strlib.h Examining data/pepper-0.3.3/tests/units/test_sys_fs.h Examining data/pepper-0.3.3/tests/units/test_sys_io.h Examining data/pepper-0.3.3/tests/units/test_utils.h FINAL RESULTS: data/pepper-0.3.3/src/strlib.cpp:135:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. std::string printf(const char *format, ...) data/pepper-0.3.3/src/strlib.cpp:146:11: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int n = vsnprintf((char *)str.c_str(), size, format, ap); data/pepper-0.3.3/src/strlib.h:76:13: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. std::string printf(const char *format, ...); data/pepper-0.3.3/src/syslib/fs.cpp:248: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(path.c_str(), X_OK) == 0); data/pepper-0.3.3/src/syslib/io.cpp:88:5: [4] (shell) execv: 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. ::execv(cmd, (char * const *)argv); data/pepper-0.3.3/src/syslib/io.cpp:117:13: [4] (shell) execv: 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. std::string execv(int *ret, const char *cmd, const char * const *argv) data/pepper-0.3.3/src/syslib/io.cpp:160:20: [4] (shell) execv: 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. std::string out = execv(ret, cmd, argv); data/pepper-0.3.3/src/syslib/io.h:31:13: [4] (shell) execv: 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. std::string execv(int *ret, const char *cmd, const char * const *argv); data/pepper-0.3.3/tests/units/test_strlib.h:137:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[0].gen = str::printf(inout[0].src); data/pepper-0.3.3/tests/units/test_strlib.h:139:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[1].gen = str::printf(inout[1].src, 2, 2, 4); data/pepper-0.3.3/tests/units/test_strlib.h:141:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[2].gen = str::printf(inout[2].src, 'a', "abc"); data/pepper-0.3.3/tests/units/test_strlib.h:143:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[3].gen = str::printf(inout[3].src, 3.14, sqrt(2.0), -1.0f, 1.0f, 3.0, -3.0); data/pepper-0.3.3/tests/units/test_strlib.h:145:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[4].gen = str::printf(inout[4].src); data/pepper-0.3.3/tests/units/test_strlib.h:147:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[5].gen = str::printf(inout[5].src, (long)-23, (unsigned long)100); data/pepper-0.3.3/tests/units/test_strlib.h:149:22: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. inout[6].gen = str::printf(inout[6].src, -4294967296LL, 4294967296ULL); data/pepper-0.3.3/src/backends/git.cpp:405:42: [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. PDEBUG << "GIT_DIR has been set to " << getenv("GIT_DIR") << endl; data/pepper-0.3.3/src/backends/git.cpp:442:38: [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. std::string cachefile = std::string(getenv("GIT_DIR")) + "/pepper.cache"; data/pepper-0.3.3/src/backends/git.cpp:444: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. std::ifstream in((std::string(getenv("GIT_DIR")) + "/pepper.cache").c_str()); data/pepper-0.3.3/src/options.cpp:180: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. if (char *cachedir = getenv("PEPPER_CACHEDIR")) { data/pepper-0.3.3/src/options.cpp:183:56: [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. m_options["cache_dir"] = str::printf("%s/.%s/cache", getenv("HOME"), PACKAGE_NAME, "cache"); data/pepper-0.3.3/src/plot.cpp:72:6: [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 (getenv("DISPLAY") && sys::io::isterm(stdout) && !Report::current()->outputRedirected()) { data/pepper-0.3.3/src/plot.cpp:77:6: [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 (getenv("GNUTERM")) { data/pepper-0.3.3/src/plot.cpp:78: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. m_standardTerminal = getenv("GNUTERM"); data/pepper-0.3.3/src/plot.cpp:644:20: [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. char *oldPager = getenv("PAGER"); data/pepper-0.3.3/src/report.cpp:81:14: [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. char *env = getenv("PEPPER_REPORTS"); data/pepper-0.3.3/src/report.cpp:545:31: [3] (buffer) getopt: 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. LUNAR_DECLARE_METHOD(Report, getopt), data/pepper-0.3.3/src/report.cpp:580:13: [3] (buffer) getopt: 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. int Report::getopt(lua_State *L) data/pepper-0.3.3/src/report.h:85:7: [3] (buffer) getopt: 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. int getopt(lua_State *L); data/pepper-0.3.3/src/syslib/fs.cpp:81:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(path.c_str(), cpath) == NULL) { data/pepper-0.3.3/src/syslib/fs.cpp:216:18: [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. char *tmpdir = getenv("TMPDIR"); data/pepper-0.3.3/src/syslib/fs.cpp:272:15: [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. char *path = getenv("PATH"); data/pepper-0.3.3/tests/backends/main.cpp:82:2: [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. srand(time(NULL)); data/pepper-0.3.3/tests/units/main.cpp:105:2: [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. srand(time(NULL)); data/pepper-0.3.3/src/3rdparty/lunar/lunar.h:172: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[34]; data/pepper-0.3.3/src/3rdparty/lunar/lunar.h:173:3: [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. sprintf(buf, "__%p", (void*)obj); data/pepper-0.3.3/src/3rdparty/lunar/lunar.h:211: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 buff[32]; data/pepper-0.3.3/src/3rdparty/lunar/lunar.h:214:3: [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. sprintf(buff, "%p", (void*)obj); data/pepper-0.3.3/src/abstractcache.h:31: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). void open() { m_backend->open(); } data/pepper-0.3.3/src/abstractcache.h:31: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). void open() { m_backend->open(); } data/pepper-0.3.3/src/backend.cpp:111:15: [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 Backend::open() data/pepper-0.3.3/src/backend.h:60:16: [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). virtual void open(); data/pepper-0.3.3/src/backends/git.cpp:204:33: [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 **args = new const char *[maxids + 4]; data/pepper-0.3.3/src/backends/git.cpp:497:14: [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 *out = fopen(newfile.c_str(), "w"); data/pepper-0.3.3/src/backends/mercurial.cpp:186:21: [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 *f = sys::fs::mkstemp(&filename); data/pepper-0.3.3/src/backends/mercurial.cpp:189: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 buf[4096]; data/pepper-0.3.3/src/backends/subversion.cpp:87:21: [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 SvnConnection::open(const std::string &url, const std::map<std::string, std::string> &options) data/pepper-0.3.3/src/backends/subversion.cpp:144:21: [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 SvnConnection::open(SvnConnection *parent) data/pepper-0.3.3/src/backends/subversion.cpp:193:4: [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 errbuf[256]; data/pepper-0.3.3/src/backends/subversion.cpp:301: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). d->open(m_backend->d); data/pepper-0.3.3/src/backends/subversion.cpp:696: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). d->open(url, m_opts.options()); data/pepper-0.3.3/src/backends/subversion_delta.cpp:432: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). d->open(connection); data/pepper-0.3.3/src/backends/subversion_p.h:34: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). void open(const std::string &url, const std::map<std::string, std::string> &options); data/pepper-0.3.3/src/backends/subversion_p.h:35: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). void open(SvnConnection *parent); data/pepper-0.3.3/src/bstream.cpp:66:3: [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(m_buffer, data, n); data/pepper-0.3.3/src/bstream.cpp:91:3: [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(ptr, m_buffer + p, nr); data/pepper-0.3.3/src/bstream.cpp:102:4: [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(newbuf, m_buffer, oldsize); data/pepper-0.3.3/src/bstream.cpp:106:3: [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(m_buffer + p, ptr, n); data/pepper-0.3.3/src/bstream.cpp:158:27: [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). : BStream(new FileStream(fopen(path.c_str(), "rbm"))) data/pepper-0.3.3/src/bstream.cpp:160:27: [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). : BStream(new FileStream(fopen(path.c_str(), "rb"))) data/pepper-0.3.3/src/bstream.cpp:176:27: [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). : BStream(new FileStream(fopen(path.c_str(), (append ? "ab" : "wb")))) data/pepper-0.3.3/src/bstream.h:224: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 buffer[120], *bptr = buffer; data/pepper-0.3.3/src/cache.cpp:250: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). m_lock = ::open(lock.c_str(), O_WRONLY | O_CREAT, S_IWUSR); data/pepper-0.3.3/src/gnuplot.cpp:34: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[1024]; data/pepper-0.3.3/src/luamodules.cpp:95:5: [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 mkstemp(lua_State *L) data/pepper-0.3.3/src/luamodules.cpp:123:18: [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). *pf = sys::fs::mkstemp(&filename, templ); data/pepper-0.3.3/src/luamodules.cpp:188:14: [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). {"mkstemp", mkstemp}, data/pepper-0.3.3/src/main.cpp:122:9: [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). out->open(files[i].c_str(), std::ios::out); data/pepper-0.3.3/src/pex.cpp:151:38: [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. str += std::string(" ")+(const char *)symbollist[i]; data/pepper-0.3.3/src/pex.cpp:171: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 buf[512]; data/pepper-0.3.3/src/pex.cpp:184:3: [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. sprintf(buf, "System error code %d", code); data/pepper-0.3.3/src/pex.cpp:189:2: [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. sprintf(buf, "System error code %d", code); data/pepper-0.3.3/src/pex.h:40: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 m_where[512]; data/pepper-0.3.3/src/plot.cpp:614:11: [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). sys::fs::mkstemp(&path); data/pepper-0.3.3/src/plot.cpp:616:6: [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). out.open(path.c_str()); data/pepper-0.3.3/src/report.cpp:271:21: [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_repo->backend()->open(); data/pepper-0.3.3/src/syslib/fs.cpp:80: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 cpath[PATH_MAX]; data/pepper-0.3.3/src/syslib/fs.cpp:107: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 cwd[FILENAME_MAX]; data/pepper-0.3.3/src/syslib/fs.cpp:208:7: [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 *mkstemp(std::string *filename, const std::string &templ) data/pepper-0.3.3/src/syslib/fs.cpp:210: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 buf[FILENAME_MAX+1]; data/pepper-0.3.3/src/syslib/fs.cpp:220:13: [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(buf); data/pepper-0.3.3/src/syslib/fs.h:41:7: [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 *mkstemp(std::string *filename, const std::string &templ = std::string()); data/pepper-0.3.3/src/syslib/io.cpp:123: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 buf[512]; data/pepper-0.3.3/src/syslib/io.cpp:147:32: [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 **argv = new const char *[9]; data/pepper-0.3.3/src/syslib/io.cpp:172:8: [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 *argv[MAX_ARGS]; data/pepper-0.3.3/src/utils.cpp:51:2: [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((char *)&dest[0], (char *)&len, 4); data/pepper-0.3.3/src/utils.cpp:74:2: [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((char *)&dlen, (char *)&data[0], 4); data/pepper-0.3.3/tests/catch/catch_runner.hpp:69: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). ofs.open( config.getFilename().c_str() ); data/pepper-0.3.3/tests/catch/internal/catch_stream.hpp:24: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 data[bufferSize]; data/pepper-0.3.3/tests/units/test_sys_io.h:41: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[1024]; data/pepper-0.3.3/src/backends/subversion.cpp:130:41: [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). prefix = apr_pstrdup(pool, this->url + strlen(root)); data/pepper-0.3.3/src/backends/subversion.cpp:376:34: [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). if (!strncmp(d->url, "file://", strlen("file://"))) { data/pepper-0.3.3/src/backends/subversion.cpp:905:19: [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). if (d->prefix && strlen(d->prefix)) { data/pepper-0.3.3/src/backends/subversion.cpp:1073:35: [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). if (!strncmp(d->url, "file://", strlen("file://"))) { data/pepper-0.3.3/src/backends/subversion_delta.cpp:347:86: [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). pristine_val = (svn_string_t *)apr_hash_get(b->pristine_props, SVN_PROP_MIME_TYPE, strlen(SVN_PROP_MIME_TYPE)); data/pepper-0.3.3/src/bstream.cpp:44:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read(void *ptr, size_t n) { data/pepper-0.3.3/src/bstream.cpp:86:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read(void *ptr, size_t n) { data/pepper-0.3.3/src/bstream.cpp:142:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read(void *ptr, size_t n) { data/pepper-0.3.3/src/bstream.h:30:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define ASSERT_READ(p, n) do { read(p, n); } while (0) data/pepper-0.3.3/src/bstream.h:33:40: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define ASSERT_READ(p, n) do { assert(read(p, n) == (ssize_t)n); } while (0) data/pepper-0.3.3/src/bstream.h:52:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual ssize_t read(void *ptr, size_t n) = 0; data/pepper-0.3.3/src/bstream.h:63:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inline ssize_t read(void *ptr, size_t n) { return (m_stream ? m_stream->read(ptr, n) : 0); } data/pepper-0.3.3/src/bstream.h:63:75: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inline ssize_t read(void *ptr, size_t n) { return (m_stream ? m_stream->read(ptr, n) : 0); } data/pepper-0.3.3/src/gnuplot.cpp:37:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buffer, sizeof(buffer)); data/pepper-0.3.3/src/syslib/fs.cpp:214:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, templ.c_str(), FILENAME_MAX); data/pepper-0.3.3/src/syslib/io.cpp:126:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fd, buf, sizeof(buf))) > 0) { data/pepper-0.3.3/src/syslib/io.cpp:293:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(d->pipe.r, start, n); data/pepper-0.3.3/tests/units/test_bstream.h:44:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sin.read(&(in[0]), i); data/pepper-0.3.3/tests/units/test_bstream.h:60:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sin.read(&(in[0]), i); data/pepper-0.3.3/tests/units/test_bstream.h:93:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t n = sin.read(&(in[0]), in.size()); data/pepper-0.3.3/tests/units/test_sys_io.h:44:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read(buffer, sizeof(buffer)); ANALYSIS SUMMARY: Hits = 110 Lines analyzed = 19208 in approximately 0.49 seconds (39386 lines/second) Physical Source Lines of Code (SLOC) = 14039 Hits@level = [0] 99 [1] 21 [2] 56 [3] 18 [4] 15 [5] 0 Hits@level+ = [0+] 209 [1+] 110 [2+] 89 [3+] 33 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 14.8871 [1+] 7.83532 [2+] 6.33948 [3+] 2.35059 [4+] 1.06845 [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.