From: Josef Bacik <josef@redhat.com>
To: Jim Meyering <jim@meyering.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Josef Bacik <josef@redhat.com>
Subject: Re: [PATCH] Btrfs: avoid buffer overrun in mount option handling
Date: Wed, 25 Apr 2012 16:03:32 -0400 [thread overview]
Message-ID: <20120425200330.GC17006@localhost.localdomain> (raw)
In-Reply-To: <87mx5z1teu.fsf@rho.meyering.net>
On Wed, Apr 25, 2012 at 09:51:53PM +0200, Jim Meyering wrote:
>
> There is an off-by-one error: allocating room for a maximal result
> string but without room for a trailing NUL. That, can lead to
> returning a transformed string that is not NUL-terminated, and then
> to a caller reading beyond end of the malloc'd buffer.
>
> Worse still, we could write one non-NUL byte beyond the end of that
> malloc'd result buffer when given a mount option of "subvol=," (i.e.,
> no arg after the "=") because here the replacement "subvolid=0" is 3
> bytes longer, not just 2.
So this can't happen, since it would be caught by btrfs_parse_early_options
which expects subvolid=%d, and if it doesn't get that it would just error out,
so while adding another byte isn't bad, it's not correct either, so fix that and
I'd say it's good to go. Thanks,
Josef
next prev parent reply other threads:[~2012-04-25 20:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 19:51 [PATCH] Btrfs: avoid buffer overrun in mount option handling Jim Meyering
2012-04-25 20:03 ` Josef Bacik [this message]
2012-04-26 9:49 ` Jim Meyering
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=20120425200330.GC17006@localhost.localdomain \
--to=josef@redhat.com \
--cc=jim@meyering.net \
--cc=linux-kernel@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