[PATCH] api: fix seccomp_export_bpf_mem out-of-bounds read
authorAlyssa Ross <hi@alyssa.is>
Thu, 13 Feb 2025 11:05:17 +0000 (12:05 +0100)
committerFelix Geyer <fgeyer@debian.org>
Thu, 20 Mar 2025 21:12:14 +0000 (22:12 +0100)
commitec1ed4de6b9e87b4051e167665b1e62cad5e854f
tree8fc73a785471603436cc16bde72f8b1c4fe6ca43
parentda7b45219f8d160e1e602ecaca031028dfb0573a
[PATCH] api: fix seccomp_export_bpf_mem out-of-bounds read

*len is the length of the destination buffer, but program->blks is
probably not anywhere near that long.  It's already been checked above
that BPF_PGM_SIZE(program) is less than or equal to *len, so that's
the correct value to use here to avoid either reading or writing too
much.

I noticed this because tests/11-basic-basic_errors started failing on
musl after e797591 ("all: add seccomp_precompute() functionality").

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Acked-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Gbp-Pq: Name api_fix_seccomp_export_bpf_mem_out-of-bounds_read.patch
src/api.c