From: Jonathan Cameron <jic23@kernel.org>
To: Brian Masney <masneyb@onstation.org>
Cc: Takashi Iwai <tiwai@suse.de>, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iio: core: Use scnprintf() for avoiding potential buffer overflow
Date: Sun, 22 Mar 2020 18:06:53 +0000 [thread overview]
Message-ID: <20200322180653.06ef9b9a@archlinux> (raw)
In-Reply-To: <20200316161935.GA1526@onstation.org>
On Mon, 16 Mar 2020 12:19:35 -0400
Brian Masney <masneyb@onstation.org> wrote:
> On Mon, Mar 16, 2020 at 01:49:40PM +0100, Takashi Iwai wrote:
> > snprintf() is a hard-to-use function, it's especially difficult to use
> > it for concatenating substrings in a buffer with a limited size.
> > Since snprintf() returns the would-be-output size, not the actual
> > size, the subsequent use of snprintf() may go beyond the given limit
> > easily. Although the current code doesn't actually overflow the
> > buffer, it's an incorrect usage.
> >
> > This patch replaces such snprintf() calls with a safer version,
> > scnprintf().
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
>
> Reviewed-by: Brian Masney <masneyb@onstation.org>
I picked this one up from v1.
Thanks,
Jonathan
next prev parent reply other threads:[~2020-03-22 18:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 12:49 [PATCH v2 0/2] iio: Use scnprintf() for avoiding potential buffer overflow Takashi Iwai
2020-03-16 12:49 ` [PATCH v2 1/2] iio: core: " Takashi Iwai
2020-03-16 16:19 ` Brian Masney
2020-03-22 18:06 ` Jonathan Cameron [this message]
2020-03-16 12:49 ` [PATCH v2 2/2] iio: tsl2772: " Takashi Iwai
2020-03-16 16:20 ` Brian Masney
2020-03-22 18:08 ` Jonathan Cameron
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=20200322180653.06ef9b9a@archlinux \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=masneyb@onstation.org \
--cc=tiwai@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).