From: Shaohua Li <shli@kernel.org>
To: Song Liu <songliubraving@fb.com>
Cc: linux-raid@vger.kernel.org, Jes.Sorensen@redhat.com, shli@fb.com
Subject: Re: [PATCH v2] mdadm: fix a buffer overflow
Date: Thu, 8 Sep 2016 10:56:36 -0700 [thread overview]
Message-ID: <20160908175636.GA21973@kernel.org> (raw)
In-Reply-To: <1473295415-1859888-1-git-send-email-songliubraving@fb.com>
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)); ?
next prev parent reply other threads:[~2016-09-08 17:56 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 [this message]
2016-09-08 18:20 ` Song Liu
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=20160908175636.GA21973@kernel.org \
--to=shli@kernel.org \
--cc=Jes.Sorensen@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=shli@fb.com \
--cc=songliubraving@fb.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.