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/kcov-38+dfsg/src/capabilities.cc Examining data/kcov-38+dfsg/src/collector.cc Examining data/kcov-38+dfsg/src/configuration.cc Examining data/kcov-38+dfsg/src/dummy-solib-handler.cc Examining data/kcov-38+dfsg/src/engine-factory.cc Examining data/kcov-38+dfsg/src/engines/bash-engine.cc Examining data/kcov-38+dfsg/src/engines/bash-execve-redirector.c Examining data/kcov-38+dfsg/src/engines/clang-coverage-engine.cc Examining data/kcov-38+dfsg/src/engines/gcov-engine.cc Examining data/kcov-38+dfsg/src/engines/kernel-engine.cc Examining data/kcov-38+dfsg/src/engines/lldb-engine.cc Examining data/kcov-38+dfsg/src/engines/ptrace.cc Examining data/kcov-38+dfsg/src/engines/ptrace_freebsd.cc Examining data/kcov-38+dfsg/src/engines/ptrace_linux.cc Examining data/kcov-38+dfsg/src/engines/python-engine.cc Examining data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc Examining data/kcov-38+dfsg/src/engines/system-mode-engine.cc Examining data/kcov-38+dfsg/src/engines/system-mode-file-format.cc Examining data/kcov-38+dfsg/src/filter.cc Examining data/kcov-38+dfsg/src/gcov.cc Examining data/kcov-38+dfsg/src/include/phdr_data.h Examining data/kcov-38+dfsg/src/kernel/kprobe-coverage.c Examining data/kcov-38+dfsg/src/main-system-daemon.cc Examining data/kcov-38+dfsg/src/main.cc Examining data/kcov-38+dfsg/src/merge-file-parser.cc Examining data/kcov-38+dfsg/src/output-handler.cc Examining data/kcov-38+dfsg/src/parser-manager.cc Examining data/kcov-38+dfsg/src/parsers/bfd-disassembler.cc Examining data/kcov-38+dfsg/src/parsers/dummy-disassembler.cc Examining data/kcov-38+dfsg/src/parsers/dwarf-libdwarf.cc Examining data/kcov-38+dfsg/src/parsers/dwarf.cc Examining data/kcov-38+dfsg/src/parsers/elf-parser.cc Examining data/kcov-38+dfsg/src/parsers/elf.cc Examining data/kcov-38+dfsg/src/parsers/libdwarf-dwarf.cpp Examining data/kcov-38+dfsg/src/reporter.cc Examining data/kcov-38+dfsg/src/solib-handler.cc Examining data/kcov-38+dfsg/src/solib-parser/lib.c Examining data/kcov-38+dfsg/src/solib-parser/phdr_data.c Examining data/kcov-38+dfsg/src/source-file-cache.cc Examining data/kcov-38+dfsg/src/system-mode/file-data.cc Examining data/kcov-38+dfsg/src/system-mode/registration.cc Examining data/kcov-38+dfsg/src/utils.cc Examining data/kcov-38+dfsg/src/writers/cobertura-writer.cc Examining data/kcov-38+dfsg/src/writers/coveralls-writer.cc Examining data/kcov-38+dfsg/src/writers/dummy-coveralls-writer.cc Examining data/kcov-38+dfsg/src/writers/html-writer.cc Examining data/kcov-38+dfsg/src/writers/json-writer.cc Examining data/kcov-38+dfsg/src/writers/sonarqube-xml-writer.cc Examining data/kcov-38+dfsg/src/writers/writer-base.cc Examining data/kcov-38+dfsg/tests/argv-dependent.c Examining data/kcov-38+dfsg/tests/daemon/test-daemon.cc Examining data/kcov-38+dfsg/tests/daemon/test-issue31.cc Examining data/kcov-38+dfsg/tests/dlopen/dlopen-main.cc Examining data/kcov-38+dfsg/tests/dlopen/dlopen.cc Examining data/kcov-38+dfsg/tests/fork/fork+exec.c Examining data/kcov-38+dfsg/tests/fork/fork-no-wait.c Examining data/kcov-38+dfsg/tests/fork/fork.c Examining data/kcov-38+dfsg/tests/fork/vfork.c Examining data/kcov-38+dfsg/tests/global-constructors/test-global-ctors.cc Examining data/kcov-38+dfsg/tests/include/header.h Examining data/kcov-38+dfsg/tests/main.cc Examining data/kcov-38+dfsg/tests/merge-tests/file.c Examining data/kcov-38+dfsg/tests/merge-tests/main_1.c Examining data/kcov-38+dfsg/tests/merge-tests/main_2.c Examining data/kcov-38+dfsg/tests/multi-fork/code-template.c Examining data/kcov-38+dfsg/tests/multi-fork/test-multi-fork.c Examining data/kcov-38+dfsg/tests/pie.c Examining data/kcov-38+dfsg/tests/popen/test-popen.c Examining data/kcov-38+dfsg/tests/recursive-ptrace/main.cc Examining data/kcov-38+dfsg/tests/sanitizer-coverage.c Examining data/kcov-38+dfsg/tests/setpgid-kill/setpgid-kill-main.cc Examining data/kcov-38+dfsg/tests/shared-library/main.c Examining data/kcov-38+dfsg/tests/shared-library/recursive-ld-preload.c Examining data/kcov-38+dfsg/tests/shared-library/solib.c Examining data/kcov-38+dfsg/tests/short-file.c Examining data/kcov-38+dfsg/tests/signals/test-signals.c Examining data/kcov-38+dfsg/tests/subdir/file.c Examining data/kcov-38+dfsg/tests/subdir2/file.c Examining data/kcov-38+dfsg/tests/subdir2/file2.c Examining data/kcov-38+dfsg/tests/test-module/test_module.c Examining data/kcov-38+dfsg/tests/threads/thread-main.c Examining data/kcov-38+dfsg/tests/unit-tests/main.cc Examining data/kcov-38+dfsg/tests/unit-tests/second-source.c Examining data/kcov-38+dfsg/tests/unit-tests/test-source.c Examining data/kcov-38+dfsg/tests/unit-tests/tests-collector.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-configuration.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-elf.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-filter.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-merge-parser.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-reporter.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-utils.cc Examining data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc Examining data/kcov-38+dfsg/tools/line2addr.cc FINAL RESULTS: data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:43:11: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. int rv = readlink("/proc/self/exe", buf, sizeof(buf)); data/kcov-38+dfsg/src/engines/system-mode-engine.cc:134:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(dst.c_str(), st.st_mode) < 0) data/kcov-38+dfsg/src/main.cc:443:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(library.c_str(), 0755) < 0) data/kcov-38+dfsg/src/engines/bash-engine.cc:210:8: [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. if (execv(vec[0], vec)) data/kcov-38+dfsg/src/engines/bash-engine.cc:482:8: [4] (shell) popen: 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. fp = popen(cmd.c_str(), "r"); data/kcov-38+dfsg/src/engines/bash-engine.cc:520:3: [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(envString, val.c_str()); data/kcov-38+dfsg/src/engines/clang-coverage-engine.cc:51:4: [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(argv[0], argv); data/kcov-38+dfsg/src/engines/gcov-engine.cc:44:4: [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(argv[0], argv); data/kcov-38+dfsg/src/engines/ptrace.cc:100:7: [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(executable.c_str(), X_OK) != 0) data/kcov-38+dfsg/src/engines/ptrace.cc:361:4: [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(executable, argv); data/kcov-38+dfsg/src/engines/python-engine.cc:88:3: [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(envString, kcov_python_env.c_str()); data/kcov-38+dfsg/src/engines/python-engine.cc:105:10: [4] (shell) system: 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. res = system(s.c_str()); data/kcov-38+dfsg/src/engines/system-mode-engine.cc:148:12: [4] (shell) system: 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. int rv = system(cmd.c_str()); data/kcov-38+dfsg/src/engines/system-mode-file-format.cc:18:2: [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(&p[out->filename_offset], mem.filename.c_str()); data/kcov-38+dfsg/src/engines/system-mode-file-format.cc:19:2: [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(&p[out->kcov_options_offset], mem.options.c_str()); data/kcov-38+dfsg/src/merge-file-parser.cc:501:3: [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(p_name, file->m_filename.c_str()); data/kcov-38+dfsg/src/parsers/bfd-disassembler.cc:402:9: [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. out = vsnprintf( str, sizeof(str) - 1, fmt, args ); data/kcov-38+dfsg/src/solib-handler.cc:120:3: [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(m_envString, kcov_solib_env.c_str()); data/kcov-38+dfsg/src/solib-handler.cc:125:3: [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(m_ldPreloadString, preloadEnv.c_str()); data/kcov-38+dfsg/src/system-mode/file-data.cc:258:2: [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(filename, m_filename.c_str()); data/kcov-38+dfsg/src/system-mode/file-data.cc:261:2: [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(options, m_options.c_str()); data/kcov-38+dfsg/src/system-mode/registration.cc:61:2: [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(entry->filename, filename.c_str()); data/kcov-38+dfsg/src/utils.cc:119:6: [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. r = vsnprintf(path, 2048, fmt, ap); data/kcov-38+dfsg/src/utils.cc:136:6: [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. r = vsnprintf(path, 2048, fmt, ap); data/kcov-38+dfsg/src/utils.cc:237:2: [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. vsnprintf(path, 2048, fmt, ap); data/kcov-38+dfsg/src/utils.cc:443:8: [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. res = vsnprintf(buf, sizeof(buf), fmt, ap); data/kcov-38+dfsg/src/utils.cc:452:9: [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. res = vsnprintf(&result[0], result.size(), fmt, ap); data/kcov-38+dfsg/src/utils.cc:591:2: [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(dst, what); data/kcov-38+dfsg/tests/fork/fork+exec.c:26:3: [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(argv[1], NULL); data/kcov-38+dfsg/tests/fork/vfork.c:21:3: [4] (shell) execle: 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. execle("/bin/ls", "/bin/ls", "/bin/ls", NULL, NULL); data/kcov-38+dfsg/tests/popen/test-popen.c:16:7: [4] (shell) popen: 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. fp = popen("/bin/ls -l /", "r"); data/kcov-38+dfsg/tests/unit-tests/tests-collector.cc:31:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/test-binary", crpcut::get_start_dir()); data/kcov-38+dfsg/tests/unit-tests/tests-elf.cc:31:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(c_str, "%s:%d", name, nr); data/kcov-38+dfsg/tests/unit-tests/tests-elf.cc:51:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/Makefile", crpcut::get_start_dir()); data/kcov-38+dfsg/tests/unit-tests/tests-elf.cc:55:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/test-binary", crpcut::get_start_dir()); data/kcov-38+dfsg/tests/unit-tests/tests-reporter.cc:43:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/test-binary", crpcut::get_start_dir()); data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc:55:2: [4] (shell) system: 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. system(fmt("rm -rf %s", outDir.c_str()).c_str()); data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc:57:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/test-binary", crpcut::get_start_dir()); data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc:143:2: [4] (shell) system: 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. system(fmt("rm -rf %s", outDir.c_str()).c_str()); data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc:145:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/same-name-test", crpcut::get_start_dir()); data/kcov-38+dfsg/src/configuration.cc:164: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. const char *path = getenv("PATH"); data/kcov-38+dfsg/src/configuration.cc:224:8: [3] (buffer) getopt_long: 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. c = getopt_long(lastArg, (char **) argv, "hp:s:l:t:", long_options, data/kcov-38+dfsg/src/configuration.cc:448:19: [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. char* rp = ::realpath(newPathPrefix.c_str(), NULL); data/kcov-38+dfsg/src/engines/bash-execve-redirector.c:84:13: [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. kcovBash = getenv("KCOV_BASH_COMMAND"); data/kcov-38+dfsg/src/engines/bash-execve-redirector.c:85: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("KCOV_BASH_USE_DEBUG_TRAP")) data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:20:28: [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 *pipePathEnv = getenv("KCOV_SYSTEM_PIPE"); data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:21:29: [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 *outputDirEnv = getenv("KCOV_SYSTEM_DESTINATION_DIR"); data/kcov-38+dfsg/src/main-system-daemon.cc:381:21: [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("KCOV_SYSTEM_DESTINATION_DIR"); data/kcov-38+dfsg/src/solib-handler.cc:97:25: [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* tmpdir = getenv("TMPDIR"); data/kcov-38+dfsg/src/solib-parser/lib.c:52: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. kcov_solib_path = getenv("KCOV_SOLIB_PATH"); data/kcov-38+dfsg/src/utils.cc:271:9: [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. return getenv("HOME"); data/kcov-38+dfsg/src/utils.cc:326:21: [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 path = getenv("PATH"); data/kcov-38+dfsg/src/utils.cc:546:9: [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. rp = ::realpath(path.c_str(), NULL); data/kcov-38+dfsg/src/engines/bash-execve-redirector.c:17: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). FILE *fp = fopen(filename, "r"); data/kcov-38+dfsg/src/engines/bash-execve-redirector.c:36: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 startBytes[128]; data/kcov-38+dfsg/src/engines/bash-execve-redirector.c:38: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 bashArg[3] = data/kcov-38+dfsg/src/engines/clang-coverage-engine.cc:141:27: [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 rv = m_dwarfParser.open(filename); data/kcov-38+dfsg/src/engines/kernel-engine.cc:70:15: [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). m_control = fopen(control.c_str(), "w"); data/kcov-38+dfsg/src/engines/kernel-engine.cc:71:12: [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). m_show = fopen(show.c_str(), "r"); data/kcov-38+dfsg/src/engines/kernel-engine.cc:86: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[256]; // More than enough for one line data/kcov-38+dfsg/src/engines/lldb-engine.cc:175: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[MAXPATHLEN + 1]; data/kcov-38+dfsg/src/engines/ptrace_linux.cc:86: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 pathname[128]; data/kcov-38+dfsg/src/engines/ptrace_linux.cc:88: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(pathname, "/proc/%d/task", pid); data/kcov-38+dfsg/src/engines/ptrace_linux.cc:228: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[100]; data/kcov-38+dfsg/src/engines/ptrace_linux.cc:232: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). status_file = fopen(buf, "r"); data/kcov-38+dfsg/src/engines/ptrace_linux.cc:255: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[100]; data/kcov-38+dfsg/src/engines/ptrace_linux.cc:261: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). procfile = fopen(buffer, "r"); data/kcov-38+dfsg/src/engines/python-engine.cc:116:12: [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). m_pipe = fopen(kcov_python_pipe_path.c_str(), "r"); data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:41: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/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:67: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). int fd = open(readbackPipe.c_str(), O_RDONLY); data/kcov-38+dfsg/src/engines/system-mode-file-format.cc:21: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(out->data, mem.data, out->n_entries * sizeof(uint32_t)); data/kcov-38+dfsg/src/engines/system-mode-file-format.cc:55: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(out->data, file.data, out->n_entries * sizeof(uint32_t)); data/kcov-38+dfsg/src/include/phdr_data.h:19: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 name[1024]; data/kcov-38+dfsg/src/kernel/kprobe-coverage.c:38: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 *module_names[32]; data/kcov-38+dfsg/src/main-system-daemon.cc:308:15: [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 *fp = fopen(out.c_str(), "w"); data/kcov-38+dfsg/src/main-system-daemon.cc:388: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 pid[256]; data/kcov-38+dfsg/src/main-system-daemon.cc:402: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). int fd = ::open(pipePath, O_RDONLY); data/kcov-38+dfsg/src/main-system-daemon.cc:419: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[4096]; data/kcov-38+dfsg/src/main.cc:95: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[255]; data/kcov-38+dfsg/src/main.cc:100:8: [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). fp = fopen(fifoName.c_str(), "r"); data/kcov-38+dfsg/src/parsers/bfd-disassembler.cc:211: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(m_data, data, size); data/kcov-38+dfsg/src/parsers/bfd-disassembler.cc:397: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 str[64]; data/kcov-38+dfsg/src/parsers/dwarf-libdwarf.cc:87:12: [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. static char *srcDirs[1] = {NULL}; data/kcov-38+dfsg/src/parsers/dwarf-libdwarf.cc:119:19: [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 DwarfParser::open(const std::string& filename) data/kcov-38+dfsg/src/parsers/dwarf-libdwarf.cc:123:19: [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_impl->m_fd = ::open(filename.c_str(), O_RDONLY); data/kcov-38+dfsg/src/parsers/dwarf.cc:196:19: [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 DwarfParser::open(const std::string& filename) data/kcov-38+dfsg/src/parsers/dwarf.cc:200:19: [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_impl->m_fd = ::open(filename.c_str(), O_RDONLY); data/kcov-38+dfsg/src/parsers/elf-parser.cc:139: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(m_filename.c_str(), O_RDONLY, 0); data/kcov-38+dfsg/src/parsers/elf-parser.cc:315: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). bool rv = dp.open(m_filename); data/kcov-38+dfsg/src/parsers/elf-parser.cc:324: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). rv = dp.open(debug_file); data/kcov-38+dfsg/src/parsers/elf-parser.cc:337: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). rv = dp.open(debugPath); data/kcov-38+dfsg/src/parsers/elf.cc:219: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((void *) &m_debugLink.second, endOfString + offs, sizeof(m_debugLink.second)); data/kcov-38+dfsg/src/solib-handler.cc:95: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 buf[1024]; data/kcov-38+dfsg/src/solib-handler.cc:144: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). m_solibFd = ::open(m_solibPath.c_str(), O_RDONLY); data/kcov-38+dfsg/src/solib-handler.cc:167: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(cpy, p, sz); data/kcov-38+dfsg/src/solib-parser/lib.c:71: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). fd = open(kcov_solib_path, O_WRONLY); data/kcov-38+dfsg/src/system-mode/file-data.cc:50: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(out, data, compressedSize); data/kcov-38+dfsg/src/system-mode/file-data.cc:60: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(out, data, dataSize); data/kcov-38+dfsg/src/system-mode/file-data.cc:127: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(m_data, fileData, fileSize); data/kcov-38+dfsg/src/system-mode/file-data.cc:227: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(out, m_data, m_fileSize); data/kcov-38+dfsg/src/system-mode/file-data.cc:250: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(out, m_data, m_fileSize); data/kcov-38+dfsg/src/system-mode/file-data.cc:263: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(start + filenameSize + optionsSize, m_entries.data(), m_entries.size() * sizeof(uint64_t)); data/kcov-38+dfsg/src/utils.cc:55: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). fd = open(path, O_RDONLY | O_NONBLOCK); data/kcov-38+dfsg/src/utils.cc:60: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). fd = open(path, O_RDONLY | O_NONBLOCK); data/kcov-38+dfsg/src/utils.cc:113: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 path[2048]; data/kcov-38+dfsg/src/utils.cc:130: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 path[2048]; data/kcov-38+dfsg/src/utils.cc:192: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). fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); data/kcov-38+dfsg/src/utils.cc:197: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). fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); data/kcov-38+dfsg/src/utils.cc:232: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 path[2048]; data/kcov-38+dfsg/src/utils.cc:388: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[1024]; data/kcov-38+dfsg/src/utils.cc:404:8: [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). dst = fopen(dst_name, "w"); data/kcov-38+dfsg/src/utils.cc:407: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). s1 = fopen(file_a, "r"); data/kcov-38+dfsg/src/utils.cc:410: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). s2 = fopen(file_b, "r"); data/kcov-38+dfsg/src/utils.cc:438: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/kcov-38+dfsg/src/utils.cc:599: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/kcov-38+dfsg/src/writers/cobertura-writer.cc:162: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 date_buf[80]; data/kcov-38+dfsg/src/writers/html-writer.cc:347: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 date_buf[128]; data/kcov-38+dfsg/src/writers/json-writer.cc:113: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 date_buf[128]; data/kcov-38+dfsg/src/writers/writer-base.cc:21: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 name[256]; data/kcov-38+dfsg/src/writers/writer-base.cc:62: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). FILE *fp = fopen(filename.c_str(), "r"); data/kcov-38+dfsg/tests/fork/vfork.c:12:10: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. child = vfork(); data/kcov-38+dfsg/tests/unit-tests/tests-collector.cc:28: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 filename[1024]; data/kcov-38+dfsg/tests/unit-tests/tests-elf.cc:45: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 filename[1024]; data/kcov-38+dfsg/tests/unit-tests/tests-merge-parser.cc:36: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(p, mock_data.data(), *out_size); data/kcov-38+dfsg/tests/unit-tests/tests-reporter.cc:41: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 filename[1024]; data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:154:3: [2] (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). Risk is low because the source is a constant string. strcpy(&p[f->filename_offset], "hej"); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:155:3: [2] (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). Risk is low because the source is a constant string. strcpy(&p[f->kcov_options_offset], "hopp"); data/kcov-38+dfsg/tests/unit-tests/tests-utils.cc:10: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[8192]; data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc: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 filename[1024]; data/kcov-38+dfsg/tests/unit-tests/tests-writer.cc:135: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 filename[1024]; data/kcov-38+dfsg/src/engines/kernel-engine.cc:94:7: [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). buf[strlen(buf) - 1] = '\0'; // Remove the \n data/kcov-38+dfsg/src/engines/ptrace_linux.cc:226:21: [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). size_t field_len = strlen(field); data/kcov-38+dfsg/src/engines/system-mode-binary-lib.cc:75:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = read(fd, buf, sizeof(buf)); data/kcov-38+dfsg/src/main-system-daemon.cc:390:18: [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). write_file(pid, strlen(pid) + 1, "%s", pidFile.c_str()); data/kcov-38+dfsg/src/main-system-daemon.cc:427:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int r = ::read(fd, buf, sizeof(buf)); data/kcov-38+dfsg/src/main.cc:430:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(~0777); data/kcov-38+dfsg/src/parsers/elf-parser.cc:94:36: [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 (memcmp(hdr->e_ident, ELFMAG, strlen(ELFMAG)) == 0) data/kcov-38+dfsg/src/parsers/elf.cc:210: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). const char *endOfString = p + strlen(p) + 1; data/kcov-38+dfsg/src/solib-handler.cc:152:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int r = read(m_solibFd, buf, sizeof(buf)); data/kcov-38+dfsg/src/solib-handler.cc:230:8: [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 (strlen(cur->name) == 0) data/kcov-38+dfsg/src/solib-parser/phdr_data.c:61:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cur->name, info->dlpi_name, sizeof(cur->name) - 1); data/kcov-38+dfsg/src/utils.cc:92:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, data + pos, chunk); data/kcov-38+dfsg/src/utils.cc:157:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). str.read(out,to_read); data/kcov-38+dfsg/src/utils.cc:589:12: [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). int len = strlen(what); data/kcov-38+dfsg/src/utils.cc:601:15: [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). size_t len = strlen(s); data/kcov-38+dfsg/src/writers/writer-base.cc:115:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p->name, name.c_str(), sizeof(p->name) - 1); data/kcov-38+dfsg/tests/threads/thread-main.c:22:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(10 * 1000); // 10 ms data/kcov-38+dfsg/tests/unit-tests/tests-merge-parser.cc:141:22: [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). ASSERT_TRUE(name + strlen(name) + 1 - (char *)p == be_to_host<uint32_t>(p->size)); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:146:5: [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). strlen("hej") + strlen("hopp") + 2); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:146:21: [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). strlen("hej") + strlen("hopp") + 2); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:153:49: [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). f->kcov_options_offset = f->filename_offset + strlen("hej") + 1; data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:172:5: [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). strlen("a") + strlen("b") + 2); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:172: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). strlen("a") + strlen("b") + 2); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:179:49: [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). f->kcov_options_offset = f->filename_offset + strlen("hej") + 1; data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:180:3: [1] (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). Risk is low because the source is a constant character. strcpy(&p[f->filename_offset], "a"); data/kcov-38+dfsg/tests/unit-tests/tests-system-mode.cc:181:3: [1] (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). Risk is low because the source is a constant character. strcpy(&p[f->kcov_options_offset], "b"); ANALYSIS SUMMARY: Hits = 156 Lines analyzed = 16845 in approximately 1.03 seconds (16424 lines/second) Physical Source Lines of Code (SLOC) = 12598 Hits@level = [0] 123 [1] 26 [2] 77 [3] 13 [4] 37 [5] 3 Hits@level+ = [0+] 279 [1+] 156 [2+] 130 [3+] 53 [4+] 40 [5+] 3 Hits/KSLOC@level+ = [0+] 22.1464 [1+] 12.3829 [2+] 10.3191 [3+] 4.20702 [4+] 3.17511 [5+] 0.238133 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.