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/bpftrace-0.11.3/resources/__stddef_max_align_t.h Examining data/bpftrace-0.11.3/resources/clang_workarounds.h Examining data/bpftrace-0.11.3/resources/float.h Examining data/bpftrace-0.11.3/resources/limits.h Examining data/bpftrace-0.11.3/resources/stdarg.h Examining data/bpftrace-0.11.3/resources/stddef.h Examining data/bpftrace-0.11.3/resources/stdint.h Examining data/bpftrace-0.11.3/scripts/seccomp.c Examining data/bpftrace-0.11.3/src/act_helpers.h Examining data/bpftrace-0.11.3/src/arch/aarch64.cpp Examining data/bpftrace-0.11.3/src/arch/arch.h Examining data/bpftrace-0.11.3/src/arch/ppc64.cpp Examining data/bpftrace-0.11.3/src/arch/s390.cpp Examining data/bpftrace-0.11.3/src/arch/x86_64.cpp Examining data/bpftrace-0.11.3/src/ast/ast.cpp Examining data/bpftrace-0.11.3/src/ast/ast.h Examining data/bpftrace-0.11.3/src/ast/async_event_types.h Examining data/bpftrace-0.11.3/src/ast/attachpoint_parser.cpp Examining data/bpftrace-0.11.3/src/ast/attachpoint_parser.h Examining data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp Examining data/bpftrace-0.11.3/src/ast/codegen_llvm.h Examining data/bpftrace-0.11.3/src/ast/field_analyser.cpp Examining data/bpftrace-0.11.3/src/ast/field_analyser.h Examining data/bpftrace-0.11.3/src/ast/irbuilderbpf.cpp Examining data/bpftrace-0.11.3/src/ast/irbuilderbpf.h Examining data/bpftrace-0.11.3/src/ast/printer.cpp Examining data/bpftrace-0.11.3/src/ast/printer.h Examining data/bpftrace-0.11.3/src/ast/semantic_analyser.cpp Examining data/bpftrace-0.11.3/src/ast/semantic_analyser.h Examining data/bpftrace-0.11.3/src/attached_probe.cpp Examining data/bpftrace-0.11.3/src/attached_probe.h Examining data/bpftrace-0.11.3/src/bfd-disasm.cpp Examining data/bpftrace-0.11.3/src/bfd-disasm.h Examining data/bpftrace-0.11.3/src/bpffeature.cpp Examining data/bpftrace-0.11.3/src/bpffeature.h Examining data/bpftrace-0.11.3/src/bpforc.h Examining data/bpftrace-0.11.3/src/bpftrace.cpp Examining data/bpftrace-0.11.3/src/bpftrace.h Examining data/bpftrace-0.11.3/src/btf.cpp Examining data/bpftrace-0.11.3/src/btf.h Examining data/bpftrace-0.11.3/src/child.cpp Examining data/bpftrace-0.11.3/src/child.h Examining data/bpftrace-0.11.3/src/clang_parser.cpp Examining data/bpftrace-0.11.3/src/clang_parser.h Examining data/bpftrace-0.11.3/src/disasm.cpp Examining data/bpftrace-0.11.3/src/disasm.h Examining data/bpftrace-0.11.3/src/driver.cpp Examining data/bpftrace-0.11.3/src/driver.h Examining data/bpftrace-0.11.3/src/fake_map.cpp Examining data/bpftrace-0.11.3/src/fake_map.h Examining data/bpftrace-0.11.3/src/headers.h Examining data/bpftrace-0.11.3/src/imap.h Examining data/bpftrace-0.11.3/src/libbpf/bpf.h Examining data/bpftrace-0.11.3/src/list.cpp Examining data/bpftrace-0.11.3/src/list.h Examining data/bpftrace-0.11.3/src/lockdown.cpp Examining data/bpftrace-0.11.3/src/lockdown.h Examining data/bpftrace-0.11.3/src/main.cpp Examining data/bpftrace-0.11.3/src/map.cpp Examining data/bpftrace-0.11.3/src/map.h Examining data/bpftrace-0.11.3/src/mapkey.cpp Examining data/bpftrace-0.11.3/src/mapkey.h Examining data/bpftrace-0.11.3/src/output.cpp Examining data/bpftrace-0.11.3/src/output.h Examining data/bpftrace-0.11.3/src/printf.cpp Examining data/bpftrace-0.11.3/src/printf.h Examining data/bpftrace-0.11.3/src/printf_format_types.h Examining data/bpftrace-0.11.3/src/procmon.cpp Examining data/bpftrace-0.11.3/src/procmon.h Examining data/bpftrace-0.11.3/src/resolve_cgroupid.cpp Examining data/bpftrace-0.11.3/src/resolve_cgroupid.h Examining data/bpftrace-0.11.3/src/signal.cpp Examining data/bpftrace-0.11.3/src/struct.cpp Examining data/bpftrace-0.11.3/src/struct.h Examining data/bpftrace-0.11.3/src/tracepoint_format_parser.cpp Examining data/bpftrace-0.11.3/src/tracepoint_format_parser.h Examining data/bpftrace-0.11.3/src/triggers.h Examining data/bpftrace-0.11.3/src/types.cpp Examining data/bpftrace-0.11.3/src/types.h Examining data/bpftrace-0.11.3/src/usdt.cpp Examining data/bpftrace-0.11.3/src/usdt.h Examining data/bpftrace-0.11.3/src/utils.cpp Examining data/bpftrace-0.11.3/src/utils.h Examining data/bpftrace-0.11.3/tests/ast.cpp Examining data/bpftrace-0.11.3/tests/bpftrace.cpp Examining data/bpftrace-0.11.3/tests/btf_common.h Examining data/bpftrace-0.11.3/tests/child.cpp Examining data/bpftrace-0.11.3/tests/childhelper.h Examining data/bpftrace-0.11.3/tests/clang_parser.cpp Examining data/bpftrace-0.11.3/tests/codegen/args_multiple_tracepoints.cpp Examining data/bpftrace-0.11.3/tests/codegen/args_multiple_tracepoints_wild.cpp Examining data/bpftrace-0.11.3/tests/codegen/basic_while_loop.cpp Examining data/bpftrace-0.11.3/tests/codegen/bitshift_left.cpp Examining data/bpftrace-0.11.3/tests/codegen/bitshift_right.cpp Examining data/bpftrace-0.11.3/tests/codegen/bitwise_not.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_arg.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_comm.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_cpid.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_cpu.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_ctx.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_ctx_field.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_curtask.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_elapsed.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_func.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_func_wild.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_kstack.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_nsecs.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_pid_tid.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_probe.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_probe_wild.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_rand.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_retval.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_sarg.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_uid_gid.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_username.cpp Examining data/bpftrace-0.11.3/tests/codegen/builtin_ustack.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_avg.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_buf.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_cat.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_cgroup.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_clear.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_count.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_delete.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_exit.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_hist.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_kstack.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_lhist.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_max.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_min.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_ntop_char16.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_ntop_char4.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_ntop_key.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_override.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_override_literal.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_print.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_print_non_map.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_printf.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_reg.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_signal.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_signal_literal.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_signal_string_literal.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_sizeof.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_stats.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_str.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_str_2_expr.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_str_2_lit.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_sum.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_system.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_time.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_ustack.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_usym_key.cpp Examining data/bpftrace-0.11.3/tests/codegen/call_zero.cpp Examining data/bpftrace-0.11.3/tests/codegen/common.h Examining data/bpftrace-0.11.3/tests/codegen/comparison_extend.cpp Examining data/bpftrace-0.11.3/tests/codegen/dereference.cpp Examining data/bpftrace-0.11.3/tests/codegen/empty_function.cpp Examining data/bpftrace-0.11.3/tests/codegen/enum.cpp Examining data/bpftrace-0.11.3/tests/codegen/general.cpp Examining data/bpftrace-0.11.3/tests/codegen/if_else_printf.cpp Examining data/bpftrace-0.11.3/tests/codegen/if_else_variable.cpp Examining data/bpftrace-0.11.3/tests/codegen/if_nested_printf.cpp Examining data/bpftrace-0.11.3/tests/codegen/if_printf.cpp Examining data/bpftrace-0.11.3/tests/codegen/if_variable.cpp Examining data/bpftrace-0.11.3/tests/codegen/int_propagation.cpp Examining data/bpftrace-0.11.3/tests/codegen/intcast_assign_var.cpp Examining data/bpftrace-0.11.3/tests/codegen/intcast_retval.cpp Examining data/bpftrace-0.11.3/tests/codegen/intptrcast_assign_var.cpp Examining data/bpftrace-0.11.3/tests/codegen/intptrcast_call.cpp Examining data/bpftrace-0.11.3/tests/codegen/literal_strncmp.cpp Examining data/bpftrace-0.11.3/tests/codegen/logical_and.cpp Examining data/bpftrace-0.11.3/tests/codegen/logical_and_or_different_type.cpp Examining data/bpftrace-0.11.3/tests/codegen/logical_not.cpp Examining data/bpftrace-0.11.3/tests/codegen/logical_or.cpp Examining data/bpftrace-0.11.3/tests/codegen/macro_definition.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_assign_int.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_assign_string.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_increment_decrement.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_key_int.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_key_probe.cpp Examining data/bpftrace-0.11.3/tests/codegen/map_key_string.cpp Examining data/bpftrace-0.11.3/tests/codegen/multiple_identical_probes.cpp Examining data/bpftrace-0.11.3/tests/codegen/nested_while_loop.cpp Examining data/bpftrace-0.11.3/tests/codegen/optional_positional_parameter.cpp Examining data/bpftrace-0.11.3/tests/codegen/pred_binop.cpp Examining data/bpftrace-0.11.3/tests/codegen/regression.cpp Examining data/bpftrace-0.11.3/tests/codegen/runtime_error_check.cpp Examining data/bpftrace-0.11.3/tests/codegen/string_equal_comparison.cpp Examining data/bpftrace-0.11.3/tests/codegen/string_not_equal_comparison.cpp Examining data/bpftrace-0.11.3/tests/codegen/string_propagation.cpp Examining data/bpftrace-0.11.3/tests/codegen/strncmp.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_char.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_integer_ptr.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_integers.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_long.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_nested_struct_anon.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_nested_struct_named.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_nested_struct_ptr_named.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_save.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_save_nested.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_save_string.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_semicolon.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_short.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_string_array.cpp Examining data/bpftrace-0.11.3/tests/codegen/struct_string_ptr.cpp Examining data/bpftrace-0.11.3/tests/codegen/ternary_int.cpp Examining data/bpftrace-0.11.3/tests/codegen/ternary_none.cpp Examining data/bpftrace-0.11.3/tests/codegen/ternary_str.cpp Examining data/bpftrace-0.11.3/tests/codegen/tuple.cpp Examining data/bpftrace-0.11.3/tests/codegen/unroll.cpp Examining data/bpftrace-0.11.3/tests/codegen/variable.cpp Examining data/bpftrace-0.11.3/tests/codegen/variable_increment_decrement.cpp Examining data/bpftrace-0.11.3/tests/data/btf_data.h Examining data/bpftrace-0.11.3/tests/main.cpp Examining data/bpftrace-0.11.3/tests/mocks.cpp Examining data/bpftrace-0.11.3/tests/mocks.h Examining data/bpftrace-0.11.3/tests/parser.cpp Examining data/bpftrace-0.11.3/tests/probe.cpp Examining data/bpftrace-0.11.3/tests/procmon.cpp Examining data/bpftrace-0.11.3/tests/semantic_analyser.cpp Examining data/bpftrace-0.11.3/tests/testlibs/simple.c Examining data/bpftrace-0.11.3/tests/testprogs/array_access.c Examining data/bpftrace-0.11.3/tests/testprogs/bitfield_test.c Examining data/bpftrace-0.11.3/tests/testprogs/complex_struct.c Examining data/bpftrace-0.11.3/tests/testprogs/intptrcast.c Examining data/bpftrace-0.11.3/tests/testprogs/mountns_wrapper.c Examining data/bpftrace-0.11.3/tests/testprogs/simple_struct.c Examining data/bpftrace-0.11.3/tests/testprogs/stack_args.c Examining data/bpftrace-0.11.3/tests/testprogs/string_args.c Examining data/bpftrace-0.11.3/tests/testprogs/syscall.c Examining data/bpftrace-0.11.3/tests/testprogs/uprobe_negative_retval.c Examining data/bpftrace-0.11.3/tests/testprogs/uprobe_test.c Examining data/bpftrace-0.11.3/tests/testprogs/usdt_inlined.c Examining data/bpftrace-0.11.3/tests/testprogs/usdt_quoted_probe.c Examining data/bpftrace-0.11.3/tests/testprogs/usdt_semaphore_test.c Examining data/bpftrace-0.11.3/tests/testprogs/usdt_sized_args.c Examining data/bpftrace-0.11.3/tests/testprogs/usdt_test.c Examining data/bpftrace-0.11.3/tests/testprogs/wait4_ru.c Examining data/bpftrace-0.11.3/tests/testprogs/watchpoint.c Examining data/bpftrace-0.11.3/tests/tracepoint_format_parser.cpp Examining data/bpftrace-0.11.3/tests/utils.cpp FINAL RESULTS: data/bpftrace-0.11.3/src/bfd-disasm.cpp:42:9: [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. len = readlink(path, tpath, size - 1); data/bpftrace-0.11.3/src/utils.cpp:137:9: [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. res = readlink(proc_path, exe_path, sizeof(exe_path)); data/bpftrace-0.11.3/tests/testprogs/mountns_wrapper.c:65: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 idx = readlink("/proc/self/exe", dpath, sizeof(dpath) - 1); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:746:93: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. createFormatStringCall(call, printf_id_, bpftrace_.printf_args_, "printf", AsyncAction::printf); data/bpftrace-0.11.3/src/attached_probe.cpp:483:5: [4] (format) snprintf: 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. snprintf(path, PATH_MAX, locs[i].path, buf.release); data/bpftrace-0.11.3/src/attached_probe.cpp:484: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(path, R_OK)) data/bpftrace-0.11.3/src/bpftrace.cpp:165:13: [4] (format) snprintf: 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 = snprintf(buffer.data(), data/bpftrace-0.11.3/src/bpftrace.cpp:174:11: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. r = snprintf(buffer.data(), data/bpftrace-0.11.3/src/bpftrace.cpp:636:40: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. bpftrace->out_->message(MessageType::printf, format(fmt, arg_values), false); data/bpftrace-0.11.3/src/btf.cpp:87: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. return vfprintf(stderr, msg, ap); data/bpftrace-0.11.3/src/btf.cpp:100:5: [4] (format) snprintf: 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. snprintf(path, PATH_MAX, locs[i].path, buf.release); data/bpftrace-0.11.3/src/btf.cpp:101: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(path, R_OK)) data/bpftrace-0.11.3/src/output.cpp:24:23: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. case MessageType::printf: out << "printf"; break; data/bpftrace-0.11.3/src/output.h:20:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf, data/bpftrace-0.11.3/src/utils.cpp:326:26: [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* modprobe = ::popen("modprobe kheaders", "w"); data/bpftrace-0.11.3/src/utils.cpp:338:19: [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* tar = ::popen(("tar xf /sys/kernel/kheaders.tar.xz -C " + tmpdir.path).c_str(), "w"); data/bpftrace-0.11.3/src/utils.cpp:451:30: [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. std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose); data/bpftrace-0.11.3/tests/semantic_analyser.cpp:893:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. TEST(semantic_analyser, printf) data/bpftrace-0.11.3/tests/semantic_analyser.cpp:910:25: [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. TEST(semantic_analyser, system) data/bpftrace-0.11.3/tests/testprogs/mountns_wrapper.c:75:10: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. return execvp(args[0], args); data/bpftrace-0.11.3/scripts/seccomp.c:152: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(argc, argv, "k:e:hl")) != -1) { data/bpftrace-0.11.3/src/attached_probe.cpp:518: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. char *env_path = std::getenv("BPFTRACE_VMLINUX"); data/bpftrace-0.11.3/src/bpftrace.cpp:804:13: [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 (!(p = realpath(probe.path.c_str(), nullptr))) data/bpftrace-0.11.3/src/btf.cpp:145: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 *path = std::getenv("BPFTRACE_BTF"); data/bpftrace-0.11.3/src/main.cpp:218: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( data/bpftrace-0.11.3/src/main.cpp:497:32: [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 (const char* env_p = std::getenv("BPFTRACE_NO_CPP_DEMANGLE")) data/bpftrace-0.11.3/src/main.cpp:522:32: [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 (const char* env_p = std::getenv("BPFTRACE_CAT_BYTES_MAX")) data/bpftrace-0.11.3/src/main.cpp:533:32: [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 (const char* env_p = std::getenv("BPFTRACE_NO_USER_SYMBOLS")) data/bpftrace-0.11.3/src/main.cpp:547:32: [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 (const char* env_p = std::getenv("BPFTRACE_CACHE_USER_SYMBOLS")) data/bpftrace-0.11.3/src/utils.cpp:118:32: [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 (const char* env_p = std::getenv(str.c_str())) data/bpftrace-0.11.3/src/utils.cpp:234:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. archenv = getenv("ARCH"); data/bpftrace-0.11.3/src/utils.cpp:309:32: [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 (const char* tmpdir = ::getenv("TMPDIR")) { data/bpftrace-0.11.3/src/utils.cpp:375:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *kpath_env = ::getenv("BPFTRACE_KERNEL_SOURCE"); data/bpftrace-0.11.3/src/utils.cpp:465: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 *env_paths = getenv("PATH"); data/bpftrace-0.11.3/src/utils.cpp:501:37: [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 resolve_binary_path(cmd, getenv("PATH"), pid); data/bpftrace-0.11.3/tests/testprogs/syscall.c:68: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("TMPDIR"); data/bpftrace-0.11.3/scripts/seccomp.c:107: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 err = atoi(substr + 1); data/bpftrace-0.11.3/src/ast/async_event_types.h:86:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char content[0]; data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:194:21: [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 arg_num = atoi(builtin.ident.substr(3).c_str()); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:232:19: [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 arg_num = atoi(builtin.ident.substr(4).c_str()); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:542: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 dynamic_sized_struct_name[30]; data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:543:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(dynamic_sized_struct_name, "buffer_%ld_t", fixed_buffer_length); data/bpftrace-0.11.3/src/ast/semantic_analyser.cpp:309:19: [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 arg_num = atoi(builtin.ident.substr(3).c_str()); data/bpftrace-0.11.3/src/attached_probe.cpp:482: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 + 1]; data/bpftrace-0.11.3/src/attached_probe.cpp:660: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 name[STRING_SIZE]; data/bpftrace-0.11.3/src/bfd-disasm.cpp:21:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd_ = open(path.c_str(), O_RDONLY); data/bpftrace-0.11.3/src/bfd-disasm.cpp:58: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 tpath[4096]; data/bpftrace-0.11.3/src/bpffeature.cpp:51: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 logbuf[log_size] = {}; data/bpftrace-0.11.3/src/bpffeature.cpp: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 logbuf[4096] = {}; data/bpftrace-0.11.3/src/bpffeature.cpp:165: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 logbuf[logsize] = {}; data/bpftrace-0.11.3/src/bpftrace.cpp:548: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 timestr[STRING_SIZE]; data/bpftrace-0.11.3/src/bpftrace.cpp:1820: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 addr_cstr[INET_ADDRSTRLEN]; data/bpftrace-0.11.3/src/bpftrace.cpp:1827: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 addr_cstr[INET6_ADDRSTRLEN]; data/bpftrace-0.11.3/src/btf.cpp:35:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(file, "rb"); data/bpftrace-0.11.3/src/btf.cpp:98: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 + 1]; data/bpftrace-0.11.3/src/btf.cpp:117: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 err_buf[256]; data/bpftrace-0.11.3/src/btf.cpp:219: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 err_buf[256]; data/bpftrace-0.11.3/src/btf.cpp:496: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 err_buf[256]; data/bpftrace-0.11.3/src/btf.cpp:599: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 err_buf[256]; data/bpftrace-0.11.3/src/main.cpp:325: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). outputstream.open(output_file); data/bpftrace-0.11.3/src/procmon.cpp:100: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(proc_path_, 0, O_RDONLY); data/bpftrace-0.11.3/src/procmon.h:48: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 proc_path_[32]; data/bpftrace-0.11.3/src/resolve_cgroupid.cpp: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 f_handle[0]; data/bpftrace-0.11.3/src/utils.cpp:99:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int new_stdio_ = open("/dev/null", O_WRONLY); data/bpftrace-0.11.3/src/utils.cpp:132: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 proc_path[512]; data/bpftrace-0.11.3/src/utils.cpp:133: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 exe_path[4096]; data/bpftrace-0.11.3/src/utils.cpp:136:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(proc_path, "/proc/%d/exe", pid); data/bpftrace-0.11.3/src/utils.cpp:540: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 pid_root[64]; data/bpftrace-0.11.3/src/utils.cpp:576: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[64]; data/bpftrace-0.11.3/src/utils.cpp:587: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). self_fd = open("/proc/self/ns/mnt", O_RDONLY); data/bpftrace-0.11.3/src/utils.cpp:594: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). target_fd = open(buf, O_RDONLY); data/bpftrace-0.11.3/src/utils.cpp:641: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[BUFSIZE]; data/bpftrace-0.11.3/src/utils.cpp:728: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 s[size * 4 + 1]; data/bpftrace-0.11.3/src/utils.cpp:733:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. offset += sprintf(s + offset, "%c", ((const uint8_t *)buf)[i]); data/bpftrace-0.11.3/src/utils.cpp:735:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. offset += sprintf(s + offset, "\\x%02x", ((const uint8_t *)buf)[i]); data/bpftrace-0.11.3/tests/bpftrace.cpp:765:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(key_data + sizeof(uint64_t) * i, &k, sizeof(k)); data/bpftrace-0.11.3/tests/bpftrace.cpp:768:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(val_data, &v, sizeof(v)); data/bpftrace-0.11.3/tests/bpftrace.cpp:787:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(val_data, &v, sizeof(v)); data/bpftrace-0.11.3/tests/bpftrace.cpp:802:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(key_data, &k, sizeof(k)); data/bpftrace-0.11.3/tests/bpftrace.cpp:804:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(val_data, &v, sizeof(v)); data/bpftrace-0.11.3/tests/btf_common.h:14:14: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(path); data/bpftrace-0.11.3/tests/codegen/common.h:323: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). file.open(versioned.str()); data/bpftrace-0.11.3/tests/codegen/common.h:328: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). file.open(fname); data/bpftrace-0.11.3/tests/testprogs/complex_struct.c:8: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 b[4]; data/bpftrace-0.11.3/tests/testprogs/complex_struct.c:24:3: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(foo.a, "\x09\x08\x07\x06"); data/bpftrace-0.11.3/tests/testprogs/mountns_wrapper.c: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 dpath[PATH_MAX]; data/bpftrace-0.11.3/tests/testprogs/mountns_wrapper.c:48: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 exe[PATH_MAX]; data/bpftrace-0.11.3/tests/testprogs/syscall.c:103: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_CREAT); data/bpftrace-0.11.3/tests/testprogs/syscall.c:110: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[10]; data/bpftrace-0.11.3/tests/testprogs/syscall.c:130: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 *newargv[129] = { NULL }; data/bpftrace-0.11.3/tests/testprogs/uprobe_test.c:11: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 b[10]; data/bpftrace-0.11.3/tests/testprogs/usdt_semaphore_test.c:16: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[100]; data/bpftrace-0.11.3/tests/testprogs/usdt_semaphore_test.c:19:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buffer, "tracetest_testprobe_semaphore: %d\n", tracetest_testprobe_semaphore); data/bpftrace-0.11.3/tests/utils.cpp:103:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open((path + "/nonexecutable").c_str(), O_CREAT, S_IRUSR); close(fd); data/bpftrace-0.11.3/tests/utils.cpp:104:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open((path + "/nonexecutable2").c_str(), O_CREAT, S_IRUSR); close(fd); data/bpftrace-0.11.3/scripts/seccomp.c:105:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, str, keysize); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:487: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). b_.CREATE_MEMSET(strlen, b_.getInt8(0), sizeof(uint64_t), 1); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:500:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). b_.CreateStore(Select, strlen); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:502:54: [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). b_.CreateStore(b_.getInt64(bpftrace_.strlen_), strlen); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:507: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). b_.CreateProbeReadStr(ctx_, buf, b_.CreateLoad(strlen), expr_, call.loc); data/bpftrace-0.11.3/src/ast/codegen_llvm.cpp:508:26: [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). b_.CreateLifetimeEnd(strlen); data/bpftrace-0.11.3/src/ast/irbuilderbpf.cpp:569:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). auto cmpAmount = strlen(str.c_str()) + 1; data/bpftrace-0.11.3/src/attached_probe.cpp:677:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, probe_.name.c_str(), STRING_SIZE - 1); data/bpftrace-0.11.3/src/child.cpp:69:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int ret = read(args->pipe_fd, &bf, 1); data/bpftrace-0.11.3/src/utils.cpp:647:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). file.read(buf, size); data/bpftrace-0.11.3/tests/bpftrace.cpp:784:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char*)key_data + STRING_SIZE*i, key.at(i).c_str(), STRING_SIZE); data/bpftrace-0.11.3/tests/bpftrace.cpp:803:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char*)key_data + sizeof(uint64_t), mystr.c_str(), STRING_SIZE); data/bpftrace-0.11.3/tests/testprogs/syscall.c:32: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). if (!isdigit(*arg) || !isdigit(arg[strlen(arg) - 1])) data/bpftrace-0.11.3/tests/testprogs/syscall.c:73: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). int path_len = strlen(tmpdir) + strlen(path_suffix); data/bpftrace-0.11.3/tests/testprogs/syscall.c:73:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int path_len = strlen(tmpdir) + strlen(path_suffix); data/bpftrace-0.11.3/tests/testprogs/syscall.c:76: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(path, tmpdir, strlen(tmpdir)); data/bpftrace-0.11.3/tests/testprogs/syscall.c:76: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). strncat(path, tmpdir, strlen(tmpdir)); data/bpftrace-0.11.3/tests/testprogs/syscall.c:77: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(path, path_suffix, strlen(path_suffix)); data/bpftrace-0.11.3/tests/testprogs/syscall.c:77:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncat(path, path_suffix, strlen(path_suffix)); data/bpftrace-0.11.3/tests/testprogs/uprobe_test.c:26:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000000); ANALYSIS SUMMARY: Hits = 115 Lines analyzed = 32709 in approximately 2.10 seconds (15568 lines/second) Physical Source Lines of Code (SLOC) = 26674 Hits@level = [0] 51 [1] 20 [2] 59 [3] 16 [4] 17 [5] 3 Hits@level+ = [0+] 166 [1+] 115 [2+] 95 [3+] 36 [4+] 20 [5+] 3 Hits/KSLOC@level+ = [0+] 6.22329 [1+] 4.31131 [2+] 3.56152 [3+] 1.34963 [4+] 0.749794 [5+] 0.112469 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.