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/atf-0.21/atf-c/detail/test_helpers.c Examining data/atf-0.21/atf-c/detail/test_helpers.h Examining data/atf-0.21/atf-c/detail/dynstr.c Examining data/atf-0.21/atf-c/detail/dynstr.h Examining data/atf-0.21/atf-c/detail/env.c Examining data/atf-0.21/atf-c/detail/env.h Examining data/atf-0.21/atf-c/detail/fs.h Examining data/atf-0.21/atf-c/detail/list.c Examining data/atf-0.21/atf-c/detail/list.h Examining data/atf-0.21/atf-c/detail/map.c Examining data/atf-0.21/atf-c/detail/map.h Examining data/atf-0.21/atf-c/detail/process.c Examining data/atf-0.21/atf-c/detail/process.h Examining data/atf-0.21/atf-c/detail/sanity.c Examining data/atf-0.21/atf-c/detail/sanity.h Examining data/atf-0.21/atf-c/detail/text.c Examining data/atf-0.21/atf-c/detail/text.h Examining data/atf-0.21/atf-c/detail/tp_main.c Examining data/atf-0.21/atf-c/detail/user.c Examining data/atf-0.21/atf-c/detail/user.h Examining data/atf-0.21/atf-c/detail/dynstr_test.c Examining data/atf-0.21/atf-c/detail/env_test.c Examining data/atf-0.21/atf-c/detail/fs_test.c Examining data/atf-0.21/atf-c/detail/list_test.c Examining data/atf-0.21/atf-c/detail/map_test.c Examining data/atf-0.21/atf-c/detail/process_helpers.c Examining data/atf-0.21/atf-c/detail/process_test.c Examining data/atf-0.21/atf-c/detail/sanity_test.c Examining data/atf-0.21/atf-c/detail/text_test.c Examining data/atf-0.21/atf-c/detail/user_test.c Examining data/atf-0.21/atf-c/detail/version_helper.c Examining data/atf-0.21/atf-c/detail/fs.c Examining data/atf-0.21/atf-c/build.h Examining data/atf-0.21/atf-c/check.h Examining data/atf-0.21/atf-c/error.h Examining data/atf-0.21/atf-c/error_fwd.h Examining data/atf-0.21/atf-c/macros.h Examining data/atf-0.21/atf-c/tc.h Examining data/atf-0.21/atf-c/tp.h Examining data/atf-0.21/atf-c/utils.h Examining data/atf-0.21/atf-c/build.c Examining data/atf-0.21/atf-c/check.c Examining data/atf-0.21/atf-c/error.c Examining data/atf-0.21/atf-c/tc.c Examining data/atf-0.21/atf-c/tp.c Examining data/atf-0.21/atf-c/utils.c Examining data/atf-0.21/atf-c/h_build.h Examining data/atf-0.21/atf-c/atf_c_test.c Examining data/atf-0.21/atf-c/build_test.c Examining data/atf-0.21/atf-c/check_test.c Examining data/atf-0.21/atf-c/error_test.c Examining data/atf-0.21/atf-c/macros_test.c Examining data/atf-0.21/atf-c/tc_test.c Examining data/atf-0.21/atf-c/tp_test.c Examining data/atf-0.21/atf-c/utils_test.c Examining data/atf-0.21/atf-c/macros_h_test.c Examining data/atf-0.21/atf-c/unused_test.c Examining data/atf-0.21/atf-c++/detail/test_helpers.cpp Examining data/atf-0.21/atf-c++/detail/test_helpers.hpp Examining data/atf-0.21/atf-c++/detail/application.cpp Examining data/atf-0.21/atf-c++/detail/application.hpp Examining data/atf-0.21/atf-c++/detail/auto_array.hpp Examining data/atf-0.21/atf-c++/detail/env.cpp Examining data/atf-0.21/atf-c++/detail/env.hpp Examining data/atf-0.21/atf-c++/detail/exceptions.cpp Examining data/atf-0.21/atf-c++/detail/exceptions.hpp Examining data/atf-0.21/atf-c++/detail/fs.hpp Examining data/atf-0.21/atf-c++/detail/process.cpp Examining data/atf-0.21/atf-c++/detail/process.hpp Examining data/atf-0.21/atf-c++/detail/sanity.hpp Examining data/atf-0.21/atf-c++/detail/text.cpp Examining data/atf-0.21/atf-c++/detail/text.hpp Examining data/atf-0.21/atf-c++/detail/application_test.cpp Examining data/atf-0.21/atf-c++/detail/auto_array_test.cpp Examining data/atf-0.21/atf-c++/detail/env_test.cpp Examining data/atf-0.21/atf-c++/detail/exceptions_test.cpp Examining data/atf-0.21/atf-c++/detail/fs_test.cpp Examining data/atf-0.21/atf-c++/detail/process_test.cpp Examining data/atf-0.21/atf-c++/detail/text_test.cpp Examining data/atf-0.21/atf-c++/detail/version_helper.cpp Examining data/atf-0.21/atf-c++/detail/fs.cpp Examining data/atf-0.21/atf-c++/build.hpp Examining data/atf-0.21/atf-c++/check.hpp Examining data/atf-0.21/atf-c++/macros.hpp Examining data/atf-0.21/atf-c++/tests.hpp Examining data/atf-0.21/atf-c++/utils.hpp Examining data/atf-0.21/atf-c++/build.cpp Examining data/atf-0.21/atf-c++/check.cpp Examining data/atf-0.21/atf-c++/tests.cpp Examining data/atf-0.21/atf-c++/utils.cpp Examining data/atf-0.21/atf-c++/atf_c++_test.cpp Examining data/atf-0.21/atf-c++/build_test.cpp Examining data/atf-0.21/atf-c++/check_test.cpp Examining data/atf-0.21/atf-c++/macros_test.cpp Examining data/atf-0.21/atf-c++/tests_test.cpp Examining data/atf-0.21/atf-c++/utils_test.cpp Examining data/atf-0.21/atf-c++/macros_hpp_test.cpp Examining data/atf-0.21/atf-c++/unused_test.cpp Examining data/atf-0.21/atf-sh/atf-sh.cpp Examining data/atf-0.21/atf-sh/atf-check.cpp Examining data/atf-0.21/bootstrap/h_tp_basic_c.c Examining data/atf-0.21/bootstrap/h_tp_basic_cpp.cpp Examining data/atf-0.21/test-programs/c_helpers.c Examining data/atf-0.21/test-programs/cpp_helpers.cpp Examining data/atf-0.21/atf-c.h Examining data/atf-0.21/atf-c++.hpp FINAL RESULTS: data/atf-0.21/atf-c++/detail/fs_test.cpp:396:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0000); data/atf-0.21/atf-c++/detail/fs_test.cpp:399:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0001); data/atf-0.21/atf-c++/detail/fs_test.cpp:402:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0010); data/atf-0.21/atf-c++/detail/fs_test.cpp:405:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0100); data/atf-0.21/atf-c++/detail/fs_test.cpp:408:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0002); data/atf-0.21/atf-c++/detail/fs_test.cpp:411:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0020); data/atf-0.21/atf-c++/detail/fs_test.cpp:414:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0200); data/atf-0.21/atf-c++/detail/fs_test.cpp:417:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0004); data/atf-0.21/atf-c++/detail/fs_test.cpp:420:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0040); data/atf-0.21/atf-c++/detail/fs_test.cpp:423:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0400); data/atf-0.21/atf-c++/detail/fs_test.cpp:426:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0644); data/atf-0.21/atf-c++/detail/fs_test.cpp:429:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0755); data/atf-0.21/atf-c++/detail/fs_test.cpp:432:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ::chmod(p.c_str(), 0777); data/atf-0.21/atf-c++/detail/fs_test.cpp:485:19: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(::chmod("files/reg", 0755) != -1); data/atf-0.21/atf-c++/utils_test.cpp:184:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod("src.txt", 0520) != -1); data/atf-0.21/atf-c/detail/fs_test.c:513:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0000); data/atf-0.21/atf-c/detail/fs_test.c:516:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0001); data/atf-0.21/atf-c/detail/fs_test.c:519:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0010); data/atf-0.21/atf-c/detail/fs_test.c:522:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0100); data/atf-0.21/atf-c/detail/fs_test.c:525:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0002); data/atf-0.21/atf-c/detail/fs_test.c:528:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0020); data/atf-0.21/atf-c/detail/fs_test.c:531:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0200); data/atf-0.21/atf-c/detail/fs_test.c:534:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0004); data/atf-0.21/atf-c/detail/fs_test.c:537:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0040); data/atf-0.21/atf-c/detail/fs_test.c:540:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0400); data/atf-0.21/atf-c/detail/fs_test.c:543:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0644); data/atf-0.21/atf-c/detail/fs_test.c:546:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0755); data/atf-0.21/atf-c/detail/fs_test.c:549:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("reg", 0777); data/atf-0.21/atf-c/detail/fs_test.c:592:21: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod(atf_fs_path_cstring(&pdir), 0000) != -1); data/atf-0.21/atf-c/detail/fs_test.c:596:21: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod(atf_fs_path_cstring(&pdir), 0755) != -1); data/atf-0.21/atf-c/detail/fs_test.c:677:17: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. ATF_REQUIRE(chown(atf_fs_path_cstring(&p), geteuid(), getegid()) != -1); data/atf-0.21/atf-c/detail/fs_test.c:686:21: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod(atf_fs_path_cstring(&p), t->fmode) != -1); data/atf-0.21/atf-c/detail/fs_test.c:796:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod("test-dir", 0555) != -1); data/atf-0.21/atf-c/utils_test.c:191:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ATF_REQUIRE(chmod("src.txt", 0520) != -1); data/atf-0.21/atf-c++/detail/application.cpp:50: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. using ::vsnprintf; data/atf-0.21/atf-c++/detail/application.cpp:68:10: [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. std::vsnprintf(m_text, sizeof(m_text), fmt, ap); data/atf-0.21/atf-c++/detail/text.cpp:49:10: [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). std::strcpy(copy, str); data/atf-0.21/atf-c/check.c:110:12: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. return execvp(file, UNCONST(argv)); data/atf-0.21/atf-c/detail/dynstr.c:56:9: [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(newdata, ad->m_data); data/atf-0.21/atf-c/detail/dynstr.c:93:9: [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(ad->m_data + ad->m_length, aux); data/atf-0.21/atf-c/detail/dynstr.c:157:15: [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. ret = vsnprintf(ad->m_data, ad->m_datasize, fmt, ap2); data/atf-0.21/atf-c/detail/fs.c:184:9: [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(str, atf_dynstr_cstring(&p->m_data)); data/atf-0.21/atf-c/detail/fs_test.c:74:12: [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(atf_fs_path_cstring(p), F_OK) == 0; data/atf-0.21/atf-c/detail/process.c:556:12: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. return execvp(file, UNCONST(argv)); data/atf-0.21/atf-c/detail/sanity.c:45:5: [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(buf, sizeof(buf), fmt, ap); data/atf-0.21/atf-c/detail/text_test.c:90:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(acum, word); data/atf-0.21/atf-c/detail/tp_main.c:95: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. vsnprintf(data.m_what, sizeof(data.m_what), fmt, ap); \ data/atf-0.21/atf-c/error.c:206:5: [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(data.m_what, sizeof(data.m_what), fmt, ap); data/atf-0.21/atf-c/tc.c:138:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, msg, ap); data/atf-0.21/atf-c/utils.c:233:21: [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. const int ret = access(path, F_OK); data/atf-0.21/atf-sh/atf-check.cpp:118:14: [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). std::strcpy(buf.get(), file.c_str()); data/atf-0.21/atf-sh/atf-sh.cpp:174:21: [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. const int ret = execv(m_shell.c_str(), const_cast< char** >(argv)); data/atf-0.21/atf-c++/detail/application.cpp:175:20: [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. while ((ch = ::getopt(m_argc, m_argv, optstr.c_str())) != -1) { data/atf-0.21/atf-c++/detail/application_test.cpp:57:24: [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. while ((ch = ::getopt(argc, argv, ":Z")) != -1) { data/atf-0.21/atf-c++/detail/application_test.cpp:78:28: [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. ATF_TEST_CASE_WITHOUT_HEAD(getopt); data/atf-0.21/atf-c++/detail/application_test.cpp:79:20: [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. ATF_TEST_CASE_BODY(getopt) data/atf-0.21/atf-c++/detail/application_test.cpp:89:28: [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. ATF_ADD_TEST_CASE(tcs, getopt); data/atf-0.21/atf-c++/tests.cpp:571:20: [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. while ((ch = ::getopt(argc, argv, GETOPT_POSIX ":lr:s:v:")) != -1) { data/atf-0.21/atf-c/detail/env.c:42:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* val = getenv(name); data/atf-0.21/atf-c/detail/env.c:50:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* val = getenv(name); data/atf-0.21/atf-c/detail/env.c:60:12: [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(name) != NULL; data/atf-0.21/atf-c/detail/tp_main.c:337:18: [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. (ch = getopt(argc, argv, GETOPT_POSIX ":lr:s:v:")) != -1) { data/atf-0.21/atf-c/tp_test.c:33:8: [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. ATF_TC(getopt); data/atf-0.21/atf-c/tp_test.c:34: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. ATF_TC_HEAD(getopt, tc) data/atf-0.21/atf-c/tp_test.c:40: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. ATF_TC_BODY(getopt, tc) data/atf-0.21/atf-c/tp_test.c:59:18: [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. while ((ch = getopt(argc, argv, ":Z")) != -1) { data/atf-0.21/atf-c/tp_test.c:85:23: [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. ATF_TP_ADD_TC(tp, getopt); data/atf-0.21/atf-c++/detail/application.hpp:42:5: [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_text[4096]; data/atf-0.21/atf-c++/detail/exceptions.cpp:117: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 buf[4096]; data/atf-0.21/atf-c++/detail/text_test.cpp:53:10: [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. std::strcpy(copy, "bar"); data/atf-0.21/atf-c++/macros_test.cpp:55: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). ATF_REQUIRE(open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644) != -1); data/atf-0.21/atf-c++/utils_test.cpp:48:5: [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/atf-0.21/atf-c++/utils_test.cpp:50:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open(path.c_str(), O_RDONLY); data/atf-0.21/atf-c++/utils_test.cpp:58:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. ((char *)buffer)[length] = '\0'; data/atf-0.21/atf-c++/utils_test.cpp:153:5: [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 long_contents[3456]; data/atf-0.21/atf-c++/utils_test.cpp:166:5: [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 long_contents[3456]; data/atf-0.21/atf-c/build_test.c:122: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 *actual[2] = { strdup("foo"), NULL }; data/atf-0.21/atf-c/build_test.c:137: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 *actual[2] = { strdup("foo"), NULL }; data/atf-0.21/atf-c/check_test.c:51:11: [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[3]; data/atf-0.21/atf-c/check_test.c:70:11: [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[4]; data/atf-0.21/atf-c/check_test.c:108:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:126:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:147:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:170:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:188:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.cpp", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:206:26: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE((sfile = fopen("test.cpp", "w")) != NULL); data/atf-0.21/atf-c/check_test.c:307:11: [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[4]; data/atf-0.21/atf-c/check_test.c:320:18: [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(path, O_RDONLY); data/atf-0.21/atf-c/check_test.c:439:18: [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(path, O_RDONLY); \ data/atf-0.21/atf-c/check_test.c:468:11: [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[3]; data/atf-0.21/atf-c/check_test.c:492:11: [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[2]; data/atf-0.21/atf-c/detail/dynstr.c:91:9: [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(ad->m_data, aux, strlen(aux)); data/atf-0.21/atf-c/detail/dynstr.c:209: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(ad->m_data, mem, memlen); data/atf-0.21/atf-c/detail/dynstr.c:267:9: [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(dest->m_data, src->m_data, src->m_datasize); data/atf-0.21/atf-c/detail/dynstr_test.c:177:5: [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[maxlen + 1]; data/atf-0.21/atf-c/detail/dynstr_test.c:375:5: [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[maxlen + 1]; data/atf-0.21/atf-c/detail/dynstr_test.c:475:5: [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[maxlen + 1]; data/atf-0.21/atf-c/detail/fs.c:79:5: [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_path[1024]; data/atf-0.21/atf-c/detail/fs.c:226: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). *fdout = mkstemp(tmpl); data/atf-0.21/atf-c/detail/fs_test.c:64: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(p, O_CREAT | O_WRONLY | O_TRUNC, mode); data/atf-0.21/atf-c/detail/fs_test.c:895:5: [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/atf-0.21/atf-c/detail/map_test.c:140:5: [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(atf_map_iter_data(iter), "Z1"); data/atf-0.21/atf-c/detail/map_test.c:285:5: [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 keys[10][5]; data/atf-0.21/atf-c/detail/map_test.c:326:5: [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 keys[10][5]; data/atf-0.21/atf-c/detail/map_test.c:382:5: [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(key, "K2"); data/atf-0.21/atf-c/detail/process.c:348: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). int aux = open(atf_fs_path_cstring(sp->m_sb->m_path), data/atf-0.21/atf-c/detail/process.c:439:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/atf-0.21/atf-c/detail/process_test.c:190: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). s->m_fd = open("stdout", O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/detail/process_test.c:194: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). s->m_fd = open("stderr", O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/detail/process_test.c:258:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ATF_REQUIRE_EQ(open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644), data/atf-0.21/atf-c/detail/process_test.c:319: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). s->m_fd = open("stdout", O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/detail/process_test.c:322: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). s->m_fd = open("stderr", O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/detail/process_test.c:836:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[16]; data/atf-0.21/atf-c/detail/process_test.c:863:11: [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[3]; data/atf-0.21/atf-c/detail/process_test.c:935:18: [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("stdout", O_RDONLY); data/atf-0.21/atf-c/detail/sanity.c:42:5: [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/atf-0.21/atf-c/detail/sanity_test.c:95:5: [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 *lines[3]; data/atf-0.21/atf-c/detail/test_helpers.c:48:11: [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 *optargs[4]; data/atf-0.21/atf-c/detail/test_helpers.c:81:5: [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 failmsg[128]; data/atf-0.21/atf-c/detail/test_helpers.c:83: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). srcfile = fopen("test.c", "w"); data/atf-0.21/atf-c/detail/text_test.c:141:5: [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 acum[1024]; data/atf-0.21/atf-c/detail/tp_main.c:71: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 m_what[2048]; \ data/atf-0.21/atf-c/detail/tp_main.c:114:5: [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/atf-0.21/atf-c/error.c:79:13: [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(err->m_data, data, datalen); data/atf-0.21/atf-c/error.c:181:5: [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_what[4096]; data/atf-0.21/atf-c/error_test.c:141:5: [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/atf-0.21/atf-c/error_test.c:192:5: [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/atf-0.21/atf-c/error_test.c:242:5: [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/atf-0.21/atf-c/h_build.h:44:11: [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 *const optargs[16]; data/atf-0.21/atf-c/h_build.h:45:11: [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 *const expargv[16]; data/atf-0.21/atf-c/h_build.h:182:11: [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 *const optargs[16]; data/atf-0.21/atf-c/h_build.h:183:11: [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 *const expargv[16]; data/atf-0.21/atf-c/h_build.h:281:11: [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 *const optargs[16]; data/atf-0.21/atf-c/h_build.h:282:11: [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 *const expargv[16]; data/atf-0.21/atf-c/macros_test.c:58: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). ATF_REQUIRE(open(atf_fs_path_cstring(&p), data/atf-0.21/atf-c/tc.c:123:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/atf-0.21/atf-c/tc.c:157:5: [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[64]; data/atf-0.21/atf-c/tc.c:215:24: [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). const int fd = open(resfile, O_WRONLY | O_CREAT | O_TRUNC, data/atf-0.21/atf-c/utils.c:62: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 buffer[1024]; data/atf-0.21/atf-c/utils.c:104:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open(name, O_RDONLY); data/atf-0.21/atf-c/utils.c:107:5: [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/atf-0.21/atf-c/utils.c:145:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open(name, O_RDONLY); data/atf-0.21/atf-c/utils.c:151:5: [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/atf-0.21/atf-c/utils.c:173:23: [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). const int input = open(source, O_RDONLY); data/atf-0.21/atf-c/utils.c:177:24: [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). const int output = open(destination, O_WRONLY | O_CREAT | O_TRUNC, 0777); data/atf-0.21/atf-c/utils.c:181:5: [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/atf-0.21/atf-c/utils.c:216:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/utils.c:309:23: [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). ATF_REQUIRE((fd = open(file, O_RDONLY)) != -1); data/atf-0.21/atf-c/utils.c:397:24: [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). const int new_fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); data/atf-0.21/atf-c/utils_test.c:58:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open(path, O_RDONLY); data/atf-0.21/atf-c/utils_test.c:63:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. ((char *)buffer)[length] = '\0'; data/atf-0.21/atf-c/utils_test.c:76:5: [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/atf-0.21/atf-c/utils_test.c:90:5: [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/atf-0.21/atf-c/utils_test.c:104:5: [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/atf-0.21/atf-c/utils_test.c:118:5: [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/atf-0.21/atf-c/utils_test.c:160:5: [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 long_contents[3456]; data/atf-0.21/atf-c/utils_test.c:173:5: [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 long_contents[3456]; data/atf-0.21/atf-c/utils_test.c:213:5: [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[128]; data/atf-0.21/atf-c/utils_test.c:251:5: [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/atf-0.21/atf-c/utils_test.c:314:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open("empty.txt", O_RDONLY); data/atf-0.21/atf-c/utils_test.c:329:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). const int fd = open("test.txt", O_RDONLY); data/atf-0.21/atf-c/utils_test.c:357:5: [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/atf-0.21/atf-c/utils_test.c:370:5: [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/atf-0.21/atf-c/utils_test.c:383:5: [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/atf-0.21/atf-sh/atf-check.cpp:120: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). m_fd = ::mkstemp(buf.get()); data/atf-0.21/atf-sh/atf-check.cpp:418: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 buf1[512], buf2[512]; data/atf-0.21/test-programs/c_helpers.c:61: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(path, O_WRONLY | O_TRUNC | O_CREAT, 0644); data/atf-0.21/test-programs/c_helpers.c:131:9: [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). f = fopen("oldvalue", "w"); data/atf-0.21/test-programs/c_helpers.c:141:9: [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). f = fopen("oldvalue", "r"); data/atf-0.21/atf-c++/build_test.cpp:80:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. while (equal && (i < aa.size() && array[i] != NULL)) { data/atf-0.21/atf-c++/build_test.cpp:87:9: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (equal && (i < aa.size() || array[i] != NULL)) data/atf-0.21/atf-c++/build_test.cpp:90:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return equal; data/atf-0.21/atf-c++/detail/text.cpp:48:32: [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). char* copy = new char[std::strlen(str) + 1]; data/atf-0.21/atf-c++/detail/text_test.cpp:50:25: [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). ATF_REQUIRE_EQ(std::strlen(copy), 3); data/atf-0.21/atf-c++/utils_test.cpp:53:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t length = read(fd, buffer, sizeof(buffer) - 1); data/atf-0.21/atf-c/build_test.c:47:10: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. bool equal; data/atf-0.21/atf-c/build_test.c:65:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return equal; data/atf-0.21/atf-c/check_test.c:475:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0222); data/atf-0.21/atf-c/detail/dynstr.c:81:29: [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). newlen = ad->m_length + strlen(aux); data/atf-0.21/atf-c/detail/dynstr.c:90:30: [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). memmove(ad->m_data + strlen(aux), ad->m_data, ad->m_length + 1); data/atf-0.21/atf-c/detail/dynstr.c:91:33: [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). memcpy(ad->m_data, aux, strlen(aux)); data/atf-0.21/atf-c/detail/dynstr.c:142: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). ad->m_datasize = strlen(fmt) + 1; data/atf-0.21/atf-c/detail/dynstr.c:211:20: [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). ad->m_length = strlen(ad->m_data); data/atf-0.21/atf-c/detail/dynstr_test.c:195:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf, "a"); data/atf-0.21/atf-c/detail/dynstr_test.c:389:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf, "a"); data/atf-0.21/atf-c/detail/dynstr_test.c:403:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(buf, "a"); data/atf-0.21/atf-c/detail/dynstr_test.c:462:45: [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). ATF_REQUIRE_EQ(atf_dynstr_length(&str), strlen("Not empty")); data/atf-0.21/atf-c/detail/env_test.c:63:17: [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). ATF_REQUIRE(strlen(val) > 0); data/atf-0.21/atf-c/detail/fs.c:111:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data.m_path, atf_fs_path_cstring(path), sizeof(data.m_path)); data/atf-0.21/atf-c/detail/fs.c:196:28: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). const mode_t current = umask(0); data/atf-0.21/atf-c/detail/fs.c:197:11: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(current); data/atf-0.21/atf-c/detail/fs.c:246:9: [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). PRE(strlen(p) > 0); data/atf-0.21/atf-c/detail/fs.c:258:13: [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(ptr) > 0) { data/atf-0.21/atf-c/detail/fs.c:301:42: [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). PRE(atf_dynstr_length(&p->m_data) == strlen(buf)); data/atf-0.21/atf-c/detail/fs_test.c:901:17: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(test_mask); data/atf-0.21/atf-c/detail/fs_test.c:903:11: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(old_umask); data/atf-0.21/atf-c/detail/process_test.c:714:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ATF_CHECK_EQ(read(atf_process_child_stdout(&child), &pid, sizeof(pid)), data/atf-0.21/atf-c/detail/process_test.c:838:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ATF_REQUIRE(read(atf_process_child_stdout(&child), buf, data/atf-0.21/atf-c/detail/text.c:103:17: [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). end = str + strlen(str); data/atf-0.21/atf-c/detail/text.c:127: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). iter = ptr + strlen(delim); data/atf-0.21/atf-c/detail/text_test.c:144:5: [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(acum, ""); data/atf-0.21/atf-c/detail/text_test.c:151:5: [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(acum, ""); data/atf-0.21/atf-c/detail/text_test.c:158:5: [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(acum, ""); data/atf-0.21/atf-c/detail/text_test.c:165:5: [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(acum, ""); data/atf-0.21/atf-c/tc.c:167:28: [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). iov[count++].iov_len = strlen(result); data/atf-0.21/atf-c/tc.c:180:32: [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). iov[count++].iov_len = strlen(r); data/atf-0.21/atf-c/utils.c:110:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((count = read(fd, buffer, sizeof(buffer) - 1)) > 0) { data/atf-0.21/atf-c/utils.c:149:25: [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). ssize_t remaining = strlen(contents); data/atf-0.21/atf-c/utils.c:153:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((count = read(fd, buffer, sizeof(buffer))) > 0 && data/atf-0.21/atf-c/utils.c:183:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((length = read(input, buffer, sizeof(buffer))) > 0) data/atf-0.21/atf-c/utils.c:367:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((cnt = read(fd, &ch, sizeof(ch))) == sizeof(ch) && data/atf-0.21/atf-c/utils.c:434:39: [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 size_t save_prefix_length = strlen(save_prefix); data/atf-0.21/atf-c/utils.c:436:9: [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(expout) > save_prefix_length && data/atf-0.21/atf-c/utils.c:445:9: [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(experr) > save_prefix_length && data/atf-0.21/atf-c/utils_test.c:60:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t length = read(fd, buffer, buflen - 1); data/atf-0.21/atf-c/utils_test.c:380: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). ATF_REQUIRE(write(15, message, strlen(message)) != -1); data/atf-0.21/atf-sh/atf-check.cpp:420:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f1.read(buf1, sizeof(buf1)); data/atf-0.21/atf-sh/atf-check.cpp:424:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f2.read(buf2, sizeof(buf2)); data/atf-0.21/atf-sh/atf-check.cpp:439:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return equal; data/atf-0.21/test-programs/c_helpers.c:199:17: [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). ATF_REQUIRE(strlen(atf_tc_get_config_var(tc, "test")) == 0); ANALYSIS SUMMARY: Hits = 220 Lines analyzed = 27494 in approximately 0.71 seconds (38777 lines/second) Physical Source Lines of Code (SLOC) = 19120 Hits@level = [0] 192 [1] 51 [2] 102 [3] 15 [4] 18 [5] 34 Hits@level+ = [0+] 412 [1+] 220 [2+] 169 [3+] 67 [4+] 52 [5+] 34 Hits/KSLOC@level+ = [0+] 21.5481 [1+] 11.5063 [2+] 8.83891 [3+] 3.50418 [4+] 2.71967 [5+] 1.77824 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.