diff options
author | Viktor Malik <vmalik@redhat.com> | 2025-01-29 08:18:57 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-02-03 03:33:51 -0800 |
commit | 0053f7d39d491b6138d7c526876d13885cbb65f1 (patch) | |
tree | 927ece76c07fe08a6f706520f96e30146a37c312 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | cb3ade567816a03d1ac1c33bf86073574efcfcaf (diff) |
bpftool: Fix readlink usage in get_fd_type
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>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions