public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Use scnprintf() for avoiding potential buffer overflow
Date: Wed, 11 Mar 2020 21:00:42 +0100	[thread overview]
Message-ID: <s5hy2s664r9.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200311182136.GH8045@magnolia>

On Wed, 11 Mar 2020 19:21:36 +0100,
Darrick J. Wong wrote:
> 
> On Wed, Mar 11, 2020 at 10:35:52AM +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>
> 
> The 'c' in 'scnprintf' means that it returns the number of bytes written
> into the buffer (not including the \0) instead of the number of bytes
> that /would/ have been written provided there was enough space, right?

Yes.


Takashi

  reply	other threads:[~2020-03-11 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  9:35 [PATCH] xfs: Use scnprintf() for avoiding potential buffer overflow Takashi Iwai
2020-03-11 18:21 ` Darrick J. Wong
2020-03-11 20:00   ` Takashi Iwai [this message]
2020-03-11 22:09 ` Dave Chinner
2020-03-12  7:01   ` Takashi Iwai
2020-03-12 22:27     ` Dave Chinner
2020-03-12 22:43       ` Darrick J. Wong
2020-03-13  5:00         ` Dave Chinner
2020-03-13  7:18           ` Takashi Iwai
2020-03-13 15:52             ` Darrick J. Wong
2020-03-15  8:49               ` Takashi Iwai
2020-03-13  6:52       ` Christoph Hellwig

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=s5hy2s664r9.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@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