From: Takashi Iwai <tiwai@suse.de>
To: Coly Li <colyli@suse.de>, Kent Overstreet <kent.overstreet@gmail.com>
Cc: linux-bcache@vger.kernel.org
Subject: Re: [PATCH] bcache: Use scnprintf() for avoiding potential buffer overflow
Date: Thu, 19 Mar 2020 16:58:46 +0100 [thread overview]
Message-ID: <s5h7dzguyix.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200311074558.8517-1-tiwai@suse.de>
On Wed, 11 Mar 2020 08:45:58 +0100,
Takashi Iwai wrote:
>
> Since snprintf() returns the would-be-output size instead of the
> actual output size, the succeeding calls may go beyond the given
> buffer limit. Fix it by replacing with scnprintf().
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
A gentle reminder for this forgotten patch.
Let me know if any further changes are needed.
thanks,
Takashi
> ---
> drivers/md/bcache/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 3470fae4eabc..323276994aab 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -154,7 +154,7 @@ static ssize_t bch_snprint_string_list(char *buf,
> size_t i;
>
> for (i = 0; list[i]; i++)
> - out += snprintf(out, buf + size - out,
> + out += scnprintf(out, buf + size - out,
> i == selected ? "[%s] " : "%s ", list[i]);
>
> out[-1] = '\n';
> --
> 2.16.4
>
next prev parent reply other threads:[~2020-03-19 15:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 7:45 [PATCH] bcache: Use scnprintf() for avoiding potential buffer overflow Takashi Iwai
2020-03-19 15:58 ` Takashi Iwai [this message]
2020-03-19 16:27 ` Coly Li
2020-03-19 16:28 ` Takashi Iwai
2020-03-19 16:32 ` Coly Li
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=s5h7dzguyix.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=colyli@suse.de \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcache@vger.kernel.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