Sha256: c842529227fda54bcf7a81c8fd6604a85dd15fcc9a575e1b43300ab669150446
Contents?: true
Size: 1.44 KB
Versions: 5
Compression:
Stored size: 1.44 KB
Contents
/* Copyright (c) 2022 Contrast Security, Inc. See * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */ #include "cs__assess_kernel.h" #include "../cs__common/cs__common.h" #include "../cs__scope/cs__scope.h" #include <ruby.h> VALUE contrast_patched_kernel_exec(const int argc, const VALUE *argv, const VALUE self) { VALUE nested_scope = inst_methods_in_cntr_scope(contrast_patcher(), 0); if (nested_scope == Qfalse && argc > 0) { /* enter scope */ inst_methods_enter_cntr_scope(contrast_patcher(), 0); VALUE data = argv[0]; rb_funcall(kernel_propagator, exec_apply_trigger, 1, data); /* exit scope */ inst_methods_exit_cntr_scope(contrast_patcher(), 0); } /* maybe this should be rb_funcall2. this works right now because *argv == * argv[0]. exec shouldn't ever be called with != 1 argc, so not a huge * problem */ return rb_funcall(self, rb_sym_assess_kernel_exec, argc, *argv); } void Init_cs__assess_kernel(void) { kernel_propagator = rb_define_module_under(core_assess, "KernelPropagator"); exec_apply_trigger = rb_intern("apply_trigger"); rb_sym_assess_kernel_exec = contrast_register_patch("Kernel", "exec", contrast_patched_kernel_exec); /* should return the same value as above */ rb_sym_assess_kernel_exec = contrast_register_singleton_patch( "Kernel", "exec", contrast_patched_kernel_exec); }
Version data entries
5 entries across 5 versions & 1 rubygems