Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Shaohua Li <shli@kernel.org>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	"Jes.Sorensen@redhat.com" <Jes.Sorensen@redhat.com>,
	Shaohua Li <shli@fb.com>
Subject: Re: [PATCH v2] mdadm: fix a buffer overflow
Date: Thu, 8 Sep 2016 18:20:43 +0000	[thread overview]
Message-ID: <C6111D12-D9A6-44AF-B2CE-84DC5C657089@fb.com> (raw)
In-Reply-To: <20160908175636.GA21973@kernel.org>

Sounds good. Let me resend. 
 
Thanks,
Song


>> On 9/8/16, 10:56 AM, "Shaohua Li" <shli@kernel.org> wrote:

    On Wed, Sep 07, 2016 at 05:43:35PM -0700, Song Liu wrote:
    > struct mdp_superblock_1.set_name is 32B long, but struct mdinfo.name
    > is 33B long. So we need strncpy instead strcpy to avoid buffer
    > overflow.
    > 
    > Signed-off-by: Song Liu <songliubraving@fb.com>
    > ---
    >  super1.c | 4 ++--
    >  1 file changed, 2 insertions(+), 2 deletions(-)
    > 
    > diff --git a/super1.c b/super1.c
    > index f3e4023..46fed54 100644
    > --- a/super1.c
    > +++ b/super1.c
    > @@ -1294,7 +1294,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
    >  			strcat(sb->set_name, ":");
    >  			strcat(sb->set_name, info->name);
    >  		} else
    > -			strcpy(sb->set_name, info->name);
    > +			strncpy(sb->set_name, info->name, 32);
    
    strncpy(sb->set_name, info->name, sizeof(sb->set_name)); ?
    
    



      reply	other threads:[~2016-09-08 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  0:43 [PATCH v2] mdadm: fix a buffer overflow Song Liu
2016-09-08 17:56 ` Shaohua Li
2016-09-08 18:20   ` Song Liu [this message]

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=C6111D12-D9A6-44AF-B2CE-84DC5C657089@fb.com \
    --to=songliubraving@fb.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=shli@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