diff options
| author | Ihor Solodrai <ihor.solodrai@linux.dev> | 2026-08-28 14:52:05 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-08-29 18:27:00 -0700 |
| commit | 4f8a4c76f6704667111d76404bdea4fef0373358 (patch) | |
| tree | b76278a081647eed38fa4a8c4179afda82c5b48f /tools/lib/python | |
| parent | 122255fb1933a57d81d05d0224d417969ec35fa9 (diff) | |
| download | linux-next-4f8a4c76f6704667111d76404bdea4fef0373358.tar.gz linux-next-4f8a4c76f6704667111d76404bdea4fef0373358.zip | |
selftests/bpf: NUL-terminate bpftool command output
run_command() writes a bpftool command's output into a caller-supplied
buffer, and every caller treats that buffer as a C string.
However fread() reports a byte count and doesn't terminate the
string. The helper does not terminate either, so callers have to zero
the buffer first. prog_tests/bpftool_metadata.c does not, for example.
Read one byte less and terminate in the helper.
Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260828215207.3105313-5-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
