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/bazel-bootstrap-3.4.0+ds/examples/windows/dll/hello-library.h Examining data/bazel-bootstrap-3.4.0+ds/examples/windows/dll/hello-library.cpp Examining data/bazel-bootstrap-3.4.0+ds/examples/windows/dll/hello_world-link-to-dll-via-lib.cpp Examining data/bazel-bootstrap-3.4.0+ds/examples/windows/dll/hello_world-load-dll-at-runtime.cpp Examining data/bazel-bootstrap-3.4.0+ds/examples/android/java/bazel/jni_dep.cc Examining data/bazel-bootstrap-3.4.0+ds/examples/android/java/bazel/jni_dep.h Examining data/bazel-bootstrap-3.4.0+ds/examples/android/java/bazel/jni.cc Examining data/bazel-bootstrap-3.4.0+ds/examples/cpp/hello-world.cc Examining data/bazel-bootstrap-3.4.0+ds/examples/cpp/hello-lib.cc Examining data/bazel-bootstrap-3.4.0+ds/examples/cpp/hello-fail.cc Examining data/bazel-bootstrap-3.4.0+ds/examples/cpp/hello-lib.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/platform_utils.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/platform_utils.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/common.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_unix.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zlib_client.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/dummy_zlib_client.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zlib_client.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file.h Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/classfile.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser_main.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser.cc Examining data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser.h Examining data/bazel-bootstrap-3.4.0+ds/tools/test/empty_test_wrapper.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/test/empty_test.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/test/windows/xml_main.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_main.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.h Examining data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/osx/crosstool/wrapped_clang.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/cpp/runfiles/runfiles_src.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/cpp/runfiles/runfiles_test.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/cpp/runfiles/runfiles_src.h Examining data/bazel-bootstrap-3.4.0+ds/tools/cpp/empty.cc Examining data/bazel-bootstrap-3.4.0+ds/tools/objc/dummy.c Examining data/bazel-bootstrap-3.4.0+ds/src/test/shell/integration/spend_cpu_time_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/shell/integration/spend_cpu_time.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/file_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/dummy_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/process_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/printarg.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/util_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/tools/process-tools_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/tools/process-tools-darwin_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/tools/process-tools-linux_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/res/app.h Examining data/bazel-bootstrap-3.4.0+ds/src/test/res/app.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/bazel_startup_options_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/workspace_layout_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/rc_file_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/test_util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/strings_windows_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/windows_test_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/windows_test_util_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/logging_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_posix_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/windows_test_util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_windows_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/numbers_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/dummy_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_windows_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/strings_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/md5_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/test_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/blaze_util_posix_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/startup_options_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/rc_options_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/blaze_util_windows_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/option_processor_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/test_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/test/cpp/blaze_util_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/cat_file.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/killmyself.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/windows/printarg.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/printargs.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc Examining data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/bar/bar.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_huge_jar_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_jartool_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_preambled_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/options.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_empty_jar_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/desugar_checking.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_bad_jar_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/options.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_ziptool_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zlib_interface_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zlib_interface.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/desugar_checking.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/singlejar_main.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/mapped_file.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/desugar_checking_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/mapped_file.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/port.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/options_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_random_jars_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/diag.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/singlejar_local_main.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/dummy.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/bash_launcher.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser_test.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/dummy.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/launcher_main.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/java_launcher.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/python_launcher.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/python_launcher.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/launcher.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/java_launcher.h Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/launcher.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/bash_launcher.cc Examining data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c Examining data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/stdredirect/StdRedirect.c Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/fsevents.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/process.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/macros.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/process.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/sleep_prevention_jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/memory_pressure_jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/jni-util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file-jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/process.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/suspend_counter_jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/processes-jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/jni-util.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/util.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/latin1_jni_path.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/latin1_jni_path.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_bsd.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_linux.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-legacy.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-legacy.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-options.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools-darwin.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-options.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-options.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles-windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-options.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools-linux.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/logging.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/logging.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/dummy-sandbox.c Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/rc_file.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_darwin.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/bazel_startup_options.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/server_process_info.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/workspace_layout.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/numbers.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path_posix.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/errors_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_windows.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_platform.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/port.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/logging.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/port.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/bazel_log_handler.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/errors_posix.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/errors.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path_platform.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/bazel_log_handler.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/logging.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/numbers.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/exit_code.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/archive_utils.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_platform.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_bsd.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/archive_utils.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/rc_file.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/main.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/server_process_info.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/option_processor.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/option_processor-internal.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/workspace_layout.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/bazel_startup_options.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/option_processor.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/startup_options.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/cpp/startup_options.h Examining data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc Examining data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_unimpl.cc FINAL RESULTS: data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:121:7: [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. if (readlink( data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:511:9: [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(path.AsNativePath().c_str(), new_mode) < 0) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:76:46: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if ((filestat.st_mode & 0777) != mode && chmod(path.c_str(), mode) == -1) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:149:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(result.c_str(), 0777 & ~um); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:332:13: [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 len = readlink(name.AsNativePath().c_str(), buf, PATH_MAX); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:184:7: [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. if (readlink(path_chars, target, arraysize(target)) == -1) { data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:199:7: [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(path_chars, static_cast<int>(mode)) == -1) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:352:14: [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 sz = readlink(path.c_str(), readlink_buffer, sizeof(readlink_buffer)); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:366:11: [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(path.c_str(), new_mode) != 0) { data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:195:16: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ASSERT_EQ(0, chmod(file.c_str(), 0100)); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:200:16: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ASSERT_EQ(0, chmod(dir.c_str(), 0500)); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:204:16: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ASSERT_EQ(0, chmod(dir.c_str(), 0700)); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:334:16: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ASSERT_EQ(0, chmod(unwritable_dir.c_str(), 0500)); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_bsd.cc:205:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(javac.c_str(), X_OK) == 0) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_darwin.cc:172:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(javac.c_str(), X_OK) == 0) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_darwin.cc:180:18: [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. FILE *output = popen("/usr/libexec/java_home -v 1.8+ 2> /dev/null", "r"); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:140:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(javac.c_str(), X_OK) == 0) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:235:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(candidate.c_str(), X_OK) == 0 && data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:317:3: [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(exe.AsNativePath().c_str(), argv.get()); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:585:11: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int r = vsnprintf(buf, sizeof buf, format, ap); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:351:11: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int r = vsnprintf(buf, sizeof buf, format, ap); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:351:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access(path.c_str(), F_OK) == 0; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:378:10: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access(path.c_str(), mode) == 0; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.cc:252:21: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int output_size = vsnprintf(nullptr, 0, format, args); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.cc:263:22: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. int print_result = vsnprintf(buf, buffer_size, format, args); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles-windows.cc:71:3: [4] (format) vfwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfwprintf(stderr, format, ap); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:72:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, args); \ data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:80:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, args); \ data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:91:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(pid_file, "%" PRIdMAX, (intmax_t) pid); data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:132:3: [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(exe, argv); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-options.cc:46:3: [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, fmt, ap); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc:105:11: [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. int r = vfprintf(stream, fmt, ap); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc:425:9: [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. if (execvp(opt.args[0], opt.args.data()) < 0) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/logging.h:26:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, __FILE__ ":" S__LINE__ ": \"" __VA_ARGS__); \ data/bazel-bootstrap-3.4.0+ds/src/main/tools/logging.h:35:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, __FILE__ ":" S__LINE__ ": " __VA_ARGS__); \ data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-legacy.cc:74:9: [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. if (execvp(opt.args[0], opt.args.data()) < 0) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-options.cc:45:3: [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, fmt, ap); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/blaze_util_posix_test.cc:81:10: [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. std::vfprintf(stderr, fmt, ap); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:167:7: [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(args[0], args); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.cc:71:3: [4] (format) vfwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfwprintf(stderr, format, ap); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.cc:85:3: [4] (format) vfwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfwprintf(stderr, format, ap); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:39:18: [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. ASSERT_EQ(0, system("zip -qm combiners.zip tag1.xml tag2.xml")); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/diag.h:41:5: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. { fprintf(stderr, prefix msg "\n", __VA_ARGS__); } data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:109:20: [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. ASSERT_EQ(0, system(rmdircmd)); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:249:16: [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. ASSERT_EQ(0, system(kTailUnzip)) << "Failed command: " << kTailUnzip; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_jartool_test.cc:40:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(output_jar, F_OK) == 0) { data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_jartool_test.cc:53: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. return system(command.c_str()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_ziptool_test.cc:33:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(output_jar, F_OK) == 0) { data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_ziptool_test.cc:46: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. return system(command.c_str()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:35:9: [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. #define popen _popen data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:84: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. return system(args_string.c_str()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:103: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. return system(verify_command.c_str()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:114:14: [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. FILE *fp = popen(command.c_str(), "rb"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:116:14: [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. FILE *fp = popen(command.c_str(), "r"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:113:18: [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. ASSERT_EQ(0, system("zip -0qm stored.zip small1 huge small2")); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:115:18: [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. ASSERT_EQ(0, system("unzip -v stored.zip")); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:124:18: [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. ASSERT_EQ(0, system("zip -qm compressed.zip 511 huge 1K")); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:126:18: [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. ASSERT_EQ(0, system("unzip -v compressed.zip")); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:454:7: [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_out_buf, filename_in); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:164: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(errmsg, 4*PATH_MAX, fmt, ap); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:281: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(errmsg, 4*PATH_MAX, fmt, ap); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zlib_client.cc:158:3: [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(errmsg, 4 * PATH_MAX, fmt, ap); data/bazel-bootstrap-3.4.0+ds/tools/osx/crosstool/wrapped_clang.cc:88:3: [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(args[0].c_str(), const_cast<char **>(exec_argv.data())); data/bazel-bootstrap-3.4.0+ds/tools/test/empty_test_wrapper.cc:25:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, data/bazel-bootstrap-3.4.0+ds/examples/windows/dll/hello_world-load-dll-at-runtime.cpp:13:14: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. hellolib = LoadLibrary(TEXT("hellolib.dll")); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:155:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(javac_dir.c_str(), resolved_path) == NULL) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:534:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* result = getenv(name.c_str()); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:541:10: [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.c_str()) != NULL; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:357:25: [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 *resolved_path = realpath(path, NULL); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/path_posix.cc:89:27: [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 *c_value = getenv(name.c_str()); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:80: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 *newpath = realpath(dirPath, NULL); // this resolve the relative path data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:173:17: [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 ((opt = getopt(argc, argv, ":al:p:")) != -1) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-options.cc:94:15: [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 ((c = getopt(args->size(), args->data(), data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-options.cc:84:15: [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. while ((c = getopt_long(args.size(), args.data(), "+:gt:k:o:e:s:dW", data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:83: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* tmp_dir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:85:30: [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* test_src_dir = getenv("TEST_SRCDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:144: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* tmp_dir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:174:24: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:239: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. char* tmpdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:326:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:368:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:69: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* tempdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:91: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* tempdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:116: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* tempdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:145:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:179:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:201:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:239:17: [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. string tmpdir(getenv("TEST_TMPDIR")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:279:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_windows_test.cc:320:30: [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* tempdir_cstr = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_posix_test.cc:164:30: [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 std::string tmpdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser_test.cc:29: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. using std::getenv; data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser_test.cc:45:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* tmpdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser_test.cc:49:16: [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. tmpdir = getenv("TEMP"); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util_test.cc:39: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. using std::getenv; data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util_test.cc: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. char* tmpdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util_test.cc:56:16: [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. tmpdir = getenv("TEMP"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:36:24: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:134: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:149: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:184: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:211: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:245: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:95: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 *out_dir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream_test.cc:59: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 *tempdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream_test.cc:89: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 *tempdir = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:64:24: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:156: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. ASSERT_EQ(0, chdir(getenv("TEST_TMPDIR"))); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c:67:20: [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 *goodPath = realpath(path, NULL); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c:92:21: [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 *realdir = realpath(dir, NULL); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/stdredirect/StdRedirect.c:55: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(env_name); data/bazel-bootstrap-3.4.0+ds/tools/cpp/runfiles/runfiles_src.cc:165:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* result = getenv(key.c_str()); data/bazel-bootstrap-3.4.0+ds/tools/cpp/runfiles/runfiles_test.cc:106:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char* result = getenv("TEST_TMPDIR"); data/bazel-bootstrap-3.4.0+ds/tools/osx/crosstool/wrapped_clang.cc:149: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. char *env_value = getenv(var_name.c_str()); data/bazel-bootstrap-3.4.0+ds/tools/osx/crosstool/wrapped_clang.cc:242:7: [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("__WRAPPED_CLANG_LOG_ONLY")) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze.cc:736:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen(path.AsNativePath().c_str(), "r"); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze.cc:744:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[255]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_bsd.cc:64: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[2048]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_bsd.cc:94:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[PATH_MAX] = {}; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_darwin.cc:128: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 pathbuf[PROC_PIDPATHINFO_MAXSIZE] = {}; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_darwin.cc:185: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[512]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:52: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[2048]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:120: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 server_cwd[PATH_MAX] = {}; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_linux.cc:154: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 resolved_path[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:479: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. unsigned char buf[blaze_util::Md5Digest::kDigestLength]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:566:43: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (fcntl(STDIN_FILENO, F_GETFL) == -1) open("/dev/null", O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:567:44: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (fcntl(STDOUT_FILENO, F_GETFL) == -1) open("/dev/null", O_WRONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:568:44: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (fcntl(STDERR_FILENO, F_GETFL) == -1) open("/dev/null", O_WRONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:582: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[1024]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_posix.cc:627: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). int lockfd = open(lockfile.AsNativePath().c_str(), O_CREAT | O_RDWR, 0644); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:182: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(data_copy.get(), data, size); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:348: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[1024]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:910: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. unsigned char md5[blaze_util::Md5Digest::kDigestLength]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:911: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 coded_name[filename_length + 1]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:1296: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 subkey_name[MAX_KEY_LENGTH]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:1383: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 found[MAX_PATH]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/bazel_log_handler.cc:78: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[16]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file.cc:36: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[kReadSize]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:269: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(filename.c_str(), O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:281: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(filename.c_str(), O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:295: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(filename.c_str(), O_CREAT | O_WRONLY | O_TRUNC, perm); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:331:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[PATH_MAX + 1]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:414: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(file_path, O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:508: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 cwdbuf[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:66:23: [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 const unsigned char kPadding[64] = { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:102: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(state, original.state, sizeof(original.state)); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:103: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(count, original.count, sizeof(original.count)); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:104: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(ctx_buffer, original.ctx_buffer, original.ctx_buffer_len); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:128:7: [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(ctx_buffer + ctx_buffer_len, input, buffer_space_len); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:137: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(ctx_buffer, input, k8Bytes); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:150: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(ctx_buffer + ctx_buffer_len, input, length); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:154:33: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. void Md5Digest::Finish(unsigned char digest[16]) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:163: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(ctx_buffer + size - 8, words, 8); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.cc:165: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(ctx_buffer + ctx_buffer_len, kPadding, size - 8 - ctx_buffer_len); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/md5.h:64: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. unsigned char ctx_buffer[128]; // input buffer data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.cc:343:10: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). return MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, output, data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:83: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 buf[1024] = "write: "; data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:182: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 target[PATH_MAX] = ""; data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:1038: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). while ((fd = open(path_chars, flags, 0666)) == -1 && errno == EINTR) { data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_bsd.cc:47: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[1024] = ""; data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:45: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[1024] = ""; data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:56: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 dirPath[PATH_MAX2]; // Have enough room for relative path data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_linux.cc:28: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[1024] = ""; data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file.cc:347: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((uint8_t*)reparse_buffer->MountPointReparseBuffer.PathBuffer + data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file.cc:350: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((uint8_t*)reparse_buffer->MountPointReparseBuffer.PathBuffer + data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file.cc:365: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((uint8_t*)reparse_buffer->MountPointReparseBuffer.PathBuffer + data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:120:21: [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 *outfile = fopen(temp_filename_.c_str(), "w"); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:125:20: [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 *infile = fopen(manifest_file.c_str(), "r"); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:132: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[3 * PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:294:22: [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.c_str(), O_CREAT|O_EXCL|O_WRONLY, 0555); data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:351: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 readlink_buffer[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:448: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 cwd_buf[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:60: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("/dev/null", O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:68: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(log_path, flags, 0666); data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:87:20: [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* pid_file = fopen(pid_path, "w"); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc:98:18: [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 *stream = fopen(filename.c_str(), "w"); data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools-linux.cc:37: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 *f = fopen("/proc/thread-self/children", "r"); data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools.cc:63: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_out = open(target_path.c_str(), flags, 0666); data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools.cc:267: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). int fd_out = open(stats_path.c_str(), flags, 0666); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:44: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(path.c_str(), O_CREAT | O_WRONLY, 0700); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:186:21: [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). AutoFileStream fh(fopen(file.c_str(), "wt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:212: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 old_wd[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:218: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 new_wd[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:260: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). AutoFd fd(open(file.c_str(), O_CREAT, 0700)); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_posix_test.cc:266: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(subfile.c_str(), O_CREAT, 0700); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:35:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[50] = {0}; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:49:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[50] = {0}; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:74:21: [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). AutoFileStream fh(fopen(filename.c_str(), "wt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:96:21: [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). AutoFileStream fh(fopen(filename.c_str(), "wt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:101:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[30]; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:124: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[6] = {0}; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:125:21: [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). AutoFileStream fh(fopen(filename.c_str(), "rt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_test.cc:133: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). fh = fopen(filename.c_str(), "rt"); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_windows_test.cc:60: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[MAX_PATH] = {0}; \ data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_windows_test.cc:189:21: [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). AutoFileStream fh(fopen(JoinPath(dir1, "foo.txt").c_str(), "wt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/file_windows_test.cc:252:21: [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). AutoFileStream fh(fopen(file.c_str(), "wt")); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/md5_test.cc:42: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. unsigned char buf[17]; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_posix_test.cc:98: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 cwdbuf[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_windows_test.cc:234: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[MAX_PATH] = {0}; data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/path_windows_test.cc:319: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[MAX_PATH] = {0}; data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/cat_file.cc:24: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* f = fopen(argv[1], "rt"); data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/killmyself.cc:36:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int sig = atoi(argv[1]); data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/process_test.cc:110:3: [2] (buffer) wchar_t: 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. wchar_t cmdline[kMaxCmdline]; data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/process_test.cc:160: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[0x10000]; data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/util_test.cc:210: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(mutable_path.get(), deepest_subdir.c_str(), data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:68: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 systemroot[MAX_PATH]; data/bazel-bootstrap-3.4.0+ds/src/test/shell/integration/spend_cpu_time.cc:74: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 current_dir_path[MAXPATHLEN]; data/bazel-bootstrap-3.4.0+ds/src/test/shell/integration/spend_cpu_time.cc:130:9: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). = atoi(argv[1]); // NOLINT(runtime/deprecated_fn) data/bazel-bootstrap-3.4.0+ds/src/test/shell/integration/spend_cpu_time.cc:132:9: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). = atoi(argv[2]); // NOLINT(runtime/deprecated_fn) data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/launcher.h:37:3: [2] (buffer) wchar_t: 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. wchar_t cmdline[MAX_CMDLINE_LENGTH]; data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.cc:191:3: [2] (buffer) wchar_t: 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. wchar_t buffer[BUFFER_SIZE]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:45: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). FILE *fp = fopen(filename, "wb"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:87: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 dirname[10]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:95: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 filepath[20]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/input_jar_scan_entries_test.h:102: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 rmdircmd[100]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_huge_jar_test.cc:41: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 *option_list[100] = {"--output", out_path.c_str()}; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:297: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(path(), mode, 0777); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:517: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(lh_new, lh, chunk1_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:519:11: [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(reinterpret_cast<uint8_t *>(lh_new) + chunk1_size, data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:525: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(lh_new, lh, lh_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:748: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_cdh, cdh, ziph::byte_ptr(ef_begin) - ziph::byte_ptr(cdh)); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:756: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_ef_end, ef_end, data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:765:7: [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_ef, ef, ef->size()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:993:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int in_fd = open(file_path, O_RDONLY); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.cc:1047: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 cds_manifest_attr[50]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:95: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 *option_list[100] = {"--output", out_path.c_str()}; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:174: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 now_time_str[50]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:188: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 entry_time_str[50]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:298: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 attr[128]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:304: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 prop[4096]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:53: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(name.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0777); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/test_util.cc:123: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[1024]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream.h:71: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). fp_ = fopen(filename, "r"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream_test.cc:62:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen(command_file_path.c_str(), "w"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes.h:230:7: [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(buffer_end - to_copy, data_block->data_, chunk_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes.h:299: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(advance(count), from, count); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:81: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). FILE *fp = fopen(filename, "wb"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:268:7: [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(file_name_, filename, len); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:290:7: [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(extra_fields(), data, data_length); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:327: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 file_name_[0]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:437:7: [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(file_name_, filename, filename_len); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:459:7: [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(extra_fields(), data, data_length); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:528: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 file_name_[0]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:584:7: [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(comment_, data, data_size); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/stdredirect/StdRedirect.c:57:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(path, O_RDWR | O_CREAT | O_APPEND); data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser.cc:309:15: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). DWORD len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, NULL, 0); data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser.cc:315:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, wstr.get(), len); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/common.h:109: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(p, src, n); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:134: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(q, data, size); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:145: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(q, classdata_out, out_length); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:156: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(buf, str, len); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:239: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(q, data, size); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:276:7: [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(buf, manifest_locator.manifest_buf_, data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:305: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(buf, line_start, len); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:450: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 filename_out_buf[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:455:7: [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(filename_out_buf + len - 4, "-interface.jar"); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_unix.cc:29: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. static char errmsg[MAX_ERROR]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_unix.cc:40: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(name, O_RDONLY); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_unix.cc:97: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(name, O_CREAT|O_RDWR|O_TRUNC, 0644); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/mapped_file_windows.cc:33: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. static char errmsg[MAX_ERROR] = ""; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:152: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 filename[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:157: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 errmsg[4*PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:276: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 errmsg[4*PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:537: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(reinterpret_cast<void*>(filename), p, len); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:557: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 filename[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:980: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(entry->file_name, filename, file_name_length_); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:125: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 path[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:155: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 output_root[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:197: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 path[PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:258: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(content, data, file_stat.total_size); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zlib_client.cc:55: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(buf, outbuf, length); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zlib_client.h:52: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 errmsg[4 * PATH_MAX]; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:885: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 data[1000]; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1806: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, pages_.get() + pos_, n1); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1816: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 + n1, pages_.get() + offs, n2); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:305:7: [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(extracted_->back().data.get(), data, size); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:432: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 content[100]; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:455: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 content[100]; data/bazel-bootstrap-3.4.0+ds/examples/android/java/bazel/jni_dep.cc:7: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). int len = strlen(str); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/blaze_util_windows.cc:529:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(result->cmdline, cmdline_str.c_str(), MAX_CMDLINE_LENGTH - 1); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:73:19: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t mask = umask(022); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:74:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(mask); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:147:21: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). const mode_t um = umask(0); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:148:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(um); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:216:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int result = read(_recv_socket, buffer, size); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:251:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int result = read(fd, data, size); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:367:48: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static bool CanAccess(const string &path, bool read, bool write, bool exec) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_posix.cc:369:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read) { data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/file_windows.cc:486:7: [1] (buffer) wcslen: 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). wcslen(long_realpath.get()) - (HasUncPrefix(long_realpath.get()) ? 4 : 0); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/numbers.cc:60: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). const char* end = start + strlen(start); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/numbers.cc:116: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). const char* end = start + strlen(text); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/numbers.cc:153: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). const char* end = start + strlen(text); data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.cc:54:15: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. std::equal(haystack.cend() - needle.length(), haystack.cend(), data/bazel-bootstrap-3.4.0+ds/src/main/cpp/util/strings.h:80: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). const int len = strlen(prefix); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:55: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). write(2, msg, strlen(msg)); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:77: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). write(2, msg, strlen(msg)); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:84:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf, strerror(errno), sizeof buf - strlen(buf) - 1); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:84:50: [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). strncat(buf, strerror(errno), sizeof buf - strlen(buf) - 1); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:85:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(buf, "\n", sizeof buf - strlen(buf) - 1); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:85: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). strncat(buf, "\n", sizeof buf - strlen(buf) - 1); data/bazel-bootstrap-3.4.0+ds/src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:86: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). write(2, buf, strlen(buf)); data/bazel-bootstrap-3.4.0+ds/src/main/native/latin1_jni_path.cc:22: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). int len = strlen(str); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:439:12: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). return ::umask(new_umask); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni.cc:501: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). len = strlen(path_chars); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:64: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). if (strlen(name) == 0 || name[0] == '/') { data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:72:11: [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 l = strlen(dirPath); data/bazel-bootstrap-3.4.0+ds/src/main/native/unix_jni_darwin.cc:79:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(dirPath, name, PATH_MAX2-l-1); data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/file-jni.cc:84:22: [1] (buffer) wcslen: 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). wcslen(result.get()))); data/bazel-bootstrap-3.4.0+ds/src/main/native/windows/process.cc:104:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(mutable_commandline.get(), commandline.c_str(), data/bazel-bootstrap-3.4.0+ds/src/main/tools/build-runfiles.cc:146: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). int n = strlen(buf)-1; data/bazel-bootstrap-3.4.0+ds/src/main/tools/daemonize.cc:117:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(pid_done_fd, &dummy, sizeof(dummy)) == -1) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc:332:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(ifr.ifr_name, "lo", IF_NAMESIZE); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox-pid1.cc:420:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(022); data/bazel-bootstrap-3.4.0+ds/src/main/tools/linux-sandbox.cc:166:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(sync_pipe[0], &buf, 1) < 0) { data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-tools-linux.cc:49:5: [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(100); data/bazel-bootstrap-3.4.0+ds/src/main/tools/process-wrapper-legacy.cc:71:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(022); data/bazel-bootstrap-3.4.0+ds/src/test/cpp/blaze_util_test.cc:48:7: [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(500); // sleep for 50ms data/bazel-bootstrap-3.4.0+ds/src/test/cpp/util/md5_test.cc:46: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). digest.Update(strs[i], strlen(strs[i])); data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/cat_file.cc:34:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read > 0) { data/bazel-bootstrap-3.4.0+ds/src/test/java/com/google/devtools/build/lib/shell/cat_file.cc:35:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fwrite(buf, 1, read, stdout); data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/process_test.cc:115:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(cmdline, wprintarg.c_str(), wprintarg.size()); data/bazel-bootstrap-3.4.0+ds/src/test/native/windows/process_test.cc:125:5: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(pcmdline, i.second.c_str(), i.second.size()); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:92:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, i.first.c_str(), i.first.size()); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:95:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, i.second.c_str(), i.second.size()); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:101:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(p, "SYSTEMROOT=", 11); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:103:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, systemroot, systemroot_size); data/bazel-bootstrap-3.4.0+ds/src/test/py/bazel/testdata/runfiles_test/foo/foo.cc:141:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(argv0.get(), bar.c_str(), bar.size()); data/bazel-bootstrap-3.4.0+ds/src/test/tools/process-tools-darwin_test.cc:149:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ASSERT_EQ(read(fds[0], &pids[i], sizeof(pids[i])), sizeof(pids[i])); data/bazel-bootstrap-3.4.0+ds/src/test/tools/process-tools-linux_test.cc:97:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ASSERT_EQ(read(fds[0], &pids[i], sizeof(pids[i])), sizeof(pids[i])); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/launcher.cc:204:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(result->cmdline, cmdline_str.c_str(), MAX_CMDLINE_LENGTH - 1); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.cc:38:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). binary->read(reinterpret_cast<char*>(&data_size), sizeof(data_size)); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.cc:45:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). binary->read(launch_data, data_size); data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.cc:51:23: [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. int64_t start, end, equal; data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/data_parser.cc:72:25: [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. } else if (start == equal) { data/bazel-bootstrap-3.4.0+ds/src/tools/launcher/util/launcher_util.cc:211:30: [1] (buffer) wcslen: 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). rand_str += alphabet[x % wcslen(alphabet)]; data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners.h:59: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). void Append(const char *s) { Append(s, strlen(s)); } data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:46: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). size_t contents_size = strlen(contents); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:76: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). EXPECT_EQ(strlen(kConcatenatedContents), original_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:165: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). EXPECT_EQ(strlen(kCombinedXmlContents), original_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/combiners_test.cc:217: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). EXPECT_EQ(strlen(kProperties), original_size); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.h:64:27: [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 n_head = strlen(head); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar.h:68:27: [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 n_tail = strlen(tail); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:602:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). auto n = entry_name.size() - strlen(".class"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/output_jar_simple_test.cc:659:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). auto n = entry_name.size() - strlen(".class"); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream.h:170:23: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). current_char_ = getc(fp_); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream.h:173:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c = getc(fp_); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/token_stream.h:175:27: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). current_char_ = getc(fp_); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes.h:68:52: [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). Append(reinterpret_cast<const uint8_t *>(str), strlen(str)); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:135: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). EXPECT_EQ(strlen(kBytesSmall), transient_bytes_->data_size()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:143: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). ASSERT_EQ((i + 1) * strlen(kBytesSmall), transient_bytes_->data_size()); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/transient_bytes_test.cc:148: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). size_t size = strlen(kBytesSmall); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:272:23: [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 name_len = strlen(name); data/bazel-bootstrap-3.4.0+ds/src/tools/singlejar/zip_headers.h:441:23: [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 name_len = strlen(name); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c:41: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). size_t len1 = strlen(path1); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c:42: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). size_t len2 = strlen(path2); data/bazel-bootstrap-3.4.0+ds/src/tools/xcode/realpath/realpath.c:69:31: [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 ((errno != ENOENT) || (strlen(path) == 0)) { data/bazel-bootstrap-3.4.0+ds/third_party/def_parser/def_parser.cc:142: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). len = strlen(find); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:37: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 CLASS_EXTENSION_LENGTH = strlen(CLASS_EXTENSION); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:39:47: [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 KOTLIN_MODULE_EXTENSION_LENGTH = strlen(KOTLIN_MODULE_EXTENSION); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:42:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). const size_t MANIFEST_DIR_PATH_LENGTH = strlen(MANIFEST_DIR_PATH); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:44:37: [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 MANIFEST_PATH_LENGTH = strlen(MANIFEST_PATH); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:48: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 MANIFEST_HEADER_LENGTH = strlen(MANIFEST_HEADER); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:52:40: [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 TARGET_LABEL_KEY_LENGTH = strlen(TARGET_LABEL_KEY); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:54:47: [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 INJECTING_RULE_KIND_KEY_LENGTH = strlen(INJECTING_RULE_KIND_KEY); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:105:31: [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 filename_len = strlen(filename); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:132:58: [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 (IsModuleInfo(filename) || IsKotlinModule(filename, strlen(filename))) { data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:155:16: [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(str); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:334: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). length += TARGET_LABEL_KEY_LENGTH + strlen(target_label) + 2; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:337:48: [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). length += INJECTING_RULE_KIND_KEY_LENGTH + strlen(injecting_rule_kind) + 2; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/ijar.cc:452: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). size_t len = strlen(filename_in); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:857: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). size_t file_name_length = strlen(filename); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:974: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). off_t file_name_length_ = strlen(filename); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip.cc:1135: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). size += strlen((zip_paths[i] != NULL) ? zip_paths[i] : files[i]) * 2; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:86:14: [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 len1 = strlen(path1); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:88:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out, path1, size - 1); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:96:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(out, path2, size - 1 - l); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:107: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). isdir = filename[strlen(filename)-1] == '/'; data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:143:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(output, pointer, output_size); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:159:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(output_root, cwd.c_str(), PATH_MAX); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:198:16: [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(final_path); data/bazel-bootstrap-3.4.0+ds/third_party/ijar/zip_main.cc:206:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path, final_path, PATH_MAX); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:818:70: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!ReadFile(handle, dest + total_read, max_read - total_read, &read, data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:824:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). total_read += read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:825:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } while (read > 0 && total_read < max_read); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:858:51: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!ReadFile(input, buffer.get(), buf_size, &read, NULL)) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:867:44: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!WriteToFile(output, buffer.get(), read)) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1204:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(result->get(), path.Get().c_str(), path.Get().size()); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1205:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(result->get() + path.Get().size(), args.c_str(), args.size() + 1); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1422:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1424:50: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (ReadFile(input_, content, kBufferSize, &read, NULL)) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1426:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read > 0 && (!WriteFile(output1_, content, read, &written, NULL) || data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1426:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read > 0 && (!WriteFile(output1_, content, read, &written, NULL) || data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1427:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). !WriteFile(output2_, content, read, &written, NULL))) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1755:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1756:53: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!ReadFile(handle, data.get(), page_size * 2, &read, NULL)) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1765:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return new IFStreamImpl(handle, std::move(data), read, page_size); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1781:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1782:60: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!ReadFile(handle_, pages_.get() + offs, page_size_, &read, NULL)) { data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1793:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). next_size_ = read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1869:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, root.c_str(), root.size()); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw.cc:1873:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, relative_paths[i].c_str(), relative_paths[i].size() + 1); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:154:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return FopenContents(wline, contents, strlen(contents)); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:433:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:434:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool success = ReadFile(h, content, 100, &read, NULL) != FALSE; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:437:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ASSERT_EQ(std::string(content, read), std::string("Hello aHello c")); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:454:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). DWORD written, read; data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:459:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_TRUE(ReadFile(read2, content, 100, &read, NULL)); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:460:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(read, 5); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:461:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(std::string(content, read), "hello"); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:462:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_TRUE(ReadFile(read3, content, 100, &read, NULL)); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:463:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(read, 5); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:464:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(std::string(content, read), "hello"); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:468:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_TRUE(ReadFile(read2, content, 100, &read, NULL)); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:469:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(read, 3); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:470:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(std::string(content, read), "foo"); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:471:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_TRUE(ReadFile(read3, content, 100, &read, NULL)); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:472:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(read, 3); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:473:34: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). EXPECT_EQ(std::string(content, read), "foo"); data/bazel-bootstrap-3.4.0+ds/tools/test/windows/tw_test.cc:489:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). AssertCdataEncodeBuffer(wline, input, strlen(input), expected_output); ANALYSIS SUMMARY: Hits = 419 Lines analyzed = 51064 in approximately 2.58 seconds (19790 lines/second) Physical Source Lines of Code (SLOC) = 35009 Hits@level = [0] 177 [1] 141 [2] 163 [3] 51 [4] 51 [5] 13 Hits@level+ = [0+] 596 [1+] 419 [2+] 278 [3+] 115 [4+] 64 [5+] 13 Hits/KSLOC@level+ = [0+] 17.0242 [1+] 11.9684 [2+] 7.94082 [3+] 3.28487 [4+] 1.8281 [5+] 0.371333 Dot directories skipped = 2 (--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.