mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karim Eshapa <karim.eshapa@gmail.com>
To: realmz6@gmail.com
Cc: adi-buildroot-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Karim Eshapa <karim.eshapa@gmail.com>
Subject: [PATCH] arch: blackfin: kernel: bfin_gpio: Use strlcpy to Copy a C-string into a sized buffer
Date: Mon, 22 May 2017 22:42:53 +0200	[thread overview]
Message-ID: <1495485773-7292-1-git-send-email-karim.eshapa@gmail.com> (raw)

Use strlcpy with sized buffer instead of strncpy to
avoid non NUL-terminated source strings problems.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
 arch/blackfin/kernel/bfin_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index c5d3128..49fca59 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -119,7 +119,7 @@ static void gpio_error(unsigned gpio)
 static void set_label(unsigned short ident, const char *label)
 {
 	if (label) {
-		strncpy(str_ident[ident].name, label,
+		strlcpy(str_ident[ident].name, label,
 			 RESOURCE_LABEL_SIZE);
 		str_ident[ident].name[RESOURCE_LABEL_SIZE - 1] = 0;
 	}
-- 
2.7.4

                 reply	other threads:[~2017-05-22 20:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1495485773-7292-1-git-send-email-karim.eshapa@gmail.com \
    --to=karim.eshapa@gmail.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=realmz6@gmail.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

all inboxes | Powered by JetHome®