From: Gabriele Monaco <gmonaco@redhat.com>
To: unknownbbqrx <dev@unknownbbqr.xyz>
Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] tools/rv: ensure monitor name and desc are NUL-terminated
Date: Thu, 04 Jun 2026 13:08:10 +0200 [thread overview]
Message-ID: <9c5f9e0d9f115024afb8165057874905f7fd6567.camel@redhat.com> (raw)
In-Reply-To: <dc9ea036-de62-4e1f-be63-8e14d675bcca@smtp-relay.sendinblue.com>
On Thu, 2026-04-23 at 17:19 +0300, unknownbbqrx wrote:
>
> ikm_fill_monitor_definition() copies monitor name and description
> with strncpy(), but does not guarantee NUL termination when source
> strings are equal to or longer than the destination buffers.
>
> Clamp copies to sizeof(dst) - 1 and explicitly append '\0' for both
> fields to keep them safe for later string operations.
>
> Signed-off-by: unknownbbqrx <dev@unknownbbqr.xyz>
Contributions need to be attributed to real people using official
names. I'm going to re-send this patch with me as author and a
Suggested-by: unknownbbqrx <dev@unknownbbqr.xyz>, unless you answer
with an appropriate attribution (i.e. your real name) [1].
Thanks,
Gabriele
[1] -
https://docs.kernel.org/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
> ---
> tools/verification/rv/src/in_kernel.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/verification/rv/src/in_kernel.c
> b/tools/verification/rv/src/in_kernel.c
> index 4bb746ea6..d32453824 100644
> --- a/tools/verification/rv/src/in_kernel.c
> +++ b/tools/verification/rv/src/in_kernel.c
> @@ -215,10 +215,11 @@ static int ikm_fill_monitor_definition(char
> *name, struct monitor *ikm, char *co
> return -1;
> }
>
> - strncpy(ikm->name, nested_name, MAX_DA_NAME_LEN);
> + strncpy(ikm->name, nested_name, sizeof(ikm->name) - 1);
> + ikm->name[sizeof(ikm->name) - 1] = '\0';
> ikm->enabled = enabled;
> - strncpy(ikm->desc, desc, MAX_DESCRIPTION);
> -
> + strncpy(ikm->desc, desc, sizeof(ikm->desc) - 1);
> + ikm->desc[sizeof(ikm->desc) - 1] = '\0';
> free(desc);
>
> return 0;
next prev parent reply other threads:[~2026-06-04 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <dc9ea036-de62-4e1f-be63-8e14d675bcca@smtp-relay.sendinblue.com>
2026-04-27 9:32 ` Gabriele Monaco
2026-06-04 11:08 ` Gabriele Monaco [this message]
2026-04-23 14:19 unknownbbqrx
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=9c5f9e0d9f115024afb8165057874905f7fd6567.camel@redhat.com \
--to=gmonaco@redhat.com \
--cc=dev@unknownbbqr.xyz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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
all inboxes | Powered by JetHome®