diff --git a/aya-log/ebpf/aya-log-ebpf-macros/src/expand.rs b/aya-log/ebpf/aya-log-ebpf-macros/src/expand.rs index 5ff93aac..f0cfc62e 100644 --- a/aya-log/ebpf/aya-log-ebpf-macros/src/expand.rs +++ b/aya-log/ebpf/aya-log-ebpf-macros/src/expand.rs @@ -92,6 +92,9 @@ pub(crate) fn log(args: LogArgs, level: Option) -> Result(record_len) #( .and_then(|record_len| { + if record_len >= buf.buf.len() { + return Err(()); + } { #formatting_exprs }.write(&mut buf.buf[record_len..]).map(|len| record_len + len) }) )* }};