From: Cyril Hrubis <chrubis@suse.cz>
To: zenghao <crawler2015@163.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] Subject: [PATCH] fs/doio:Use the snprintf function to prevent buffer overflow
Date: Fri, 21 Apr 2023 13:25:45 +0200 [thread overview]
Message-ID: <ZEJyud8Yxb1QdZbh@yuki> (raw)
In-Reply-To: <3620f7c2.2af5.18768f7ce86.Coremail.crawler2015@163.com>
Hi!
> From 044a942863dc0ac84701bc14d78f4d7fc0bb8dcb Mon Sep 17 00:00:00 2001
> From: Hao Zeng <zenghao@kylinos.cn>
> Date: Mon, 10 Apr 2023 09:17:34 +0800
> Subject: [PATCH] fs/doio:Use the snprintf function to prevent buffer overflow
> Use the snprintf function instead of sprintf in the write_log.c file
> Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
The actual change looks good, however the patch is corrupted, looks like
your email client replaced spaces 0x20 with unicode non-breakable spaces
0xc2a0.
See: https://www.kernel.org/doc/html/v4.10/process/email-clients.html
> ---
> testcases/kernel/fs/doio/write_log.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
>
> diff --git a/testcases/kernel/fs/doio/write_log.c b/testcases/kernel/fs/doio/write_log.c
> index e8ef9c7cb..86297b01d 100644
> --- a/testcases/kernel/fs/doio/write_log.c
> +++ b/testcases/kernel/fs/doio/write_log.c
> @@ -129,7 +129,7 @@ int wlog_open(struct wlog_file *wfile, int trunc, int mode)
> umask(omask);
>
> if (wfile->w_afd == -1) {
> - sprintf(Wlog_Error_String,
> + snprintf(Wlog_Error_String,sizeof(Wlog_Error_String),
^
There should be space after
comma.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-04-21 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 2:21 [LTP] Subject: [PATCH] fs/doio:Use the snprintf function to prevent buffer overflow zenghao
2023-04-21 11:25 ` Cyril Hrubis [this message]
2023-04-23 3:04 ` zenghao
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=ZEJyud8Yxb1QdZbh@yuki \
--to=chrubis@suse.cz \
--cc=crawler2015@163.com \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.