Skip to content

Commit

Permalink
Validate jump target before updating vm->int_funcs (#432)
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
  • Loading branch information
Alan-Jowett and Alan Jowett committed Apr 22, 2024
1 parent 2c163d6 commit dfcad9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vm/ubpf_vm.c
Expand Up @@ -1065,7 +1065,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;
Expand Down

0 comments on commit dfcad9d

Please sign in to comment.