From 3cf7f1197f6674d3cc82282224e3a2416fe7e34c Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Mon, 22 Apr 2024 09:34:14 -0700 Subject: [PATCH] Validate jump target before updating vm->int_funcs (#432) Signed-off-by: Alan Jowett Co-authored-by: Alan Jowett --- vm/ubpf_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/ubpf_vm.c b/vm/ubpf_vm.c index 5556f830..8e9341d0 100644 --- a/vm/ubpf_vm.c +++ b/vm/ubpf_vm.c @@ -1118,7 +1118,7 @@ validate(const struct ubpf_vm* vm, const struct ebpf_inst* insts, uint32_t num_i } } else if (inst.src == 1) { int call_target = i + (inst.imm + 1); - if (call_target < 0 || call_target > num_insts) { + if (call_target < 0 || call_target >= num_insts) { *errmsg = ubpf_error("call to local function (at PC %d) is out of bounds (target: %d)", i, call_target); return false;