From: Quentin Monnet <qmo@kernel.org>
To: Viktor Malik <vmalik@redhat.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH bpf-next] bpftool: Fix readlink usage in get_fd_type
Date: Wed, 29 Jan 2025 23:15:03 +0000 [thread overview]
Message-ID: <cc1b1c21-94c2-4f3b-a51b-93c5dcdcde87@kernel.org> (raw)
In-Reply-To: <20250129071857.75182-1-vmalik@redhat.com>
2025-01-29 08:18 UTC+0100 ~ Viktor Malik <vmalik@redhat.com>
> 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>
Nice, thank you!
Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Reviewed-by: Quentin Monnet <qmo@kernel.org>
next prev parent reply other threads:[~2025-01-29 23:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 7:18 [PATCH bpf-next] bpftool: Fix readlink usage in get_fd_type Viktor Malik
2025-01-29 23:15 ` Quentin Monnet [this message]
2025-01-30 1:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc1b1c21-94c2-4f3b-a51b-93c5dcdcde87@kernel.org \
--to=qmo@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=vmalik@redhat.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox