public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Filipe David Manana <fdmanana@gmail.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] Btrfs-progs: set string end sing '\0' for property
Date: Fri, 25 Apr 2014 18:37:23 +0800	[thread overview]
Message-ID: <20140425103722.GB6138@localhost.localdomain> (raw)
In-Reply-To: <CAL3q7H5jR5xDWi=jKTu_HthUpjzp9hFEByueXBru0Edj=o1o6g@mail.gmail.com>

On Fri, Apr 25, 2014 at 11:07:49AM +0100, Filipe David Manana wrote:
> On Fri, Apr 25, 2014 at 7:29 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> > Set string "xattr_name" 's end with '\0' so that it won't be
> > violated in memory.
> >
> > With this fix, xfstest/btrfs/048 can pass on my box.
> >
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  props.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/props.c b/props.c
> > index 4d0aeea..53223a3 100644
> > --- a/props.c
> > +++ b/props.c
> > @@ -135,6 +135,7 @@ static int prop_compression(enum prop_object_type type,
> >         }
> >         memcpy(xattr_name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN);
> >         memcpy(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name));
> > +       xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0';
> 
> Buffer overrun. You need to sum + 1 to the malloc argument above.

Oops, I made that mistake.

thanks,
-liubo

  reply	other threads:[~2014-04-25 10:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25  6:29 [PATCH 1/2] Btrfs-progs: set string end sing '\0' for property Liu Bo
2014-04-25  6:29 ` [PATCH 2/2] Btrfs-progs: open file with O_RDONLY on getting property Liu Bo
2014-04-25 10:04   ` Filipe David Manana
2014-04-25 10:38     ` Liu Bo
2014-04-25 10:07 ` [PATCH 1/2] Btrfs-progs: set string end sing '\0' for property Filipe David Manana
2014-04-25 10:37   ` Liu Bo [this message]
2014-04-25 10:44 ` [PATCH v2] " Liu Bo
2014-04-25 10:51   ` Filipe David Manana
  -- strict thread matches above, loose matches on Subject: below --
2014-04-25  6:28 [PATCH 1/2] " Liu Bo
2014-04-25  5:50 Liu Bo

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=20140425103722.GB6138@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@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