bpf, array: fix heap out-of-bounds access when updating elements