diff --git a/bpf/aya-bpf/src/helpers.rs b/bpf/aya-bpf/src/helpers.rs index b740f4b9..715f25a2 100644 --- a/bpf/aya-bpf/src/helpers.rs +++ b/bpf/aya-bpf/src/helpers.rs @@ -430,6 +430,11 @@ pub unsafe fn bpf_probe_read_user_str_bytes( return Err(-1); } + // verifier complains if this check is missing on v5.19 + if len < 1 { + return Err(-1); + } + // len includes NULL byte Ok(&dest[..len - 1]) } @@ -583,6 +588,11 @@ pub unsafe fn bpf_probe_read_kernel_str_bytes( return Err(-1); } + // verifier complains if this check is missing on v5.19 + if len < 1 { + return Err(-1); + } + // len includes NULL byte Ok(&dest[..len - 1]) }