linux-yocto/tools/bpf
Viktor Malik 15c799f7f8 bpftool: Fix readlink usage in get_fd_type
[ Upstream commit 0053f7d39d ]

The `readlink(path, buf, sizeof(buf))` call reads at most sizeof(buf)
bytes and *does not* append null-terminator to buf. With respect to
that, fix two pieces in get_fd_type:

1. Change the truncation check to contain sizeof(buf) rather than
   sizeof(path).
2. Append null-terminator to buf.

Reported by Coverity.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20250129071857.75182-1-vmalik@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:38:04 +02:00
..
bpftool bpftool: Fix readlink usage in get_fd_type 2025-06-04 14:38:04 +02:00
resolve_btfids bpf: Fix potential integer overflow in resolve_btfids 2024-06-16 13:39:50 +02:00
runqslower
.gitignore
bpf_asm.c
bpf_dbg.c
bpf_exp.l
bpf_exp.y
bpf_jit_disasm.c
Makefile