Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux390@de.ibm.com, linux-s390@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] s390: ensure NUL termination by strncpy()
Date: Mon, 16 Nov 2009 19:53:54 +0100	[thread overview]
Message-ID: <4B019FC2.3060004@gmail.com> (raw)

For a larger source string, strncpy only NUL terminates when
the size argument is less than the size of the destination string.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 arch/s390/kernel/ipl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Is this maybe needed?

diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 4890ac6..d52fcb4 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -1881,7 +1881,7 @@ void __init setup_ipl(void)
 		break;
 	case IPL_TYPE_NSS:
 		strncpy(ipl_info.data.nss.name, kernel_nss_name,
-			sizeof(ipl_info.data.nss.name));
+			sizeof(ipl_info.data.nss.name) - 1);
 		break;
 	case IPL_TYPE_UNKNOWN:
 		/* We have no info to copy */

             reply	other threads:[~2009-11-16 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16 18:53 Roel Kluin [this message]
2009-11-16 21:13 ` [PATCH] s390: ensure NUL termination by strncpy() Heiko Carstens

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=4B019FC2.3060004@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=schwidefsky@de.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox