From 9bf2f8e9a7ab840b7752d46d9f1c729158538c74 Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Mon, 22 Apr 2024 08:29:08 -0700 Subject: [PATCH] Validate jump target before updating vm->int_funcs Signed-off-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;