mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>
Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org,
	phillip@lougher.demon.co.uk, hsweeten@visionengravers.com,
	hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] initramfs: strcpy destination string overflow
Date: Tue, 5 Oct 2010 19:44:49 +0800	[thread overview]
Message-ID: <20101005114449.GI5170@cr0.nay.redhat.com> (raw)
In-Reply-To: <b6cdf32448371a89fdab2f3875ac5b32365bf518.1286193211.git.EXT-Eugeny.Kuznetsov@nokia.com>

On Tue, Oct 05, 2010 at 12:44:17PM +0400, Evgeny Kuznetsov wrote:
>From: Evgeny Kuznetsov <ext-eugeny.kuznetsov@nokia.com>
>
>Function "strcpy()" is used without check for maximum allowed
>source string length and could cause destination string overflow.
>"strcpy()" is replaced by "strlcpy()" to prevent destination
>string overflow.
>
>Signed-off-by: Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>


Looks good to me,

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>

>---
> init/initramfs.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/init/initramfs.c b/init/initramfs.c
>index 4b9c202..3e68568 100644
>--- a/init/initramfs.c
>+++ b/init/initramfs.c
>@@ -56,7 +56,7 @@ static char __init *find_link(int major, int minor, int ino,
> 	q->minor = minor;
> 	q->ino = ino;
> 	q->mode = mode;
>-	strcpy(q->name, name);
>+	strlcpy(q->name, name, sizeof(q->name));
> 	q->next = NULL;
> 	*p = q;
> 	return NULL;
>-- 
>1.6.3.3
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2010-10-05 11:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05  8:44 [PATCH 0/1] " Evgeny Kuznetsov
2010-10-05  8:44 ` [PATCH 1/1] " Evgeny Kuznetsov
2010-10-05 11:44   ` Américo Wang [this message]
2010-10-05 15:55   ` Linus Torvalds
2010-10-05 16:00     ` H. Peter Anvin
2010-10-05 16:51     ` Al Viro
2010-10-05 18:09       ` H. Peter Anvin
2010-10-06  8:58         ` Evgeny Kuznetsov

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=20101005114449.GI5170@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=EXT-Eugeny.Kuznetsov@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillip@lougher.demon.co.uk \
    --cc=torvalds@linux-foundation.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

Powered by JetHome