* [PATCH] arch: blackfin: kernel: bfin_gpio: Use strlcpy to Copy a C-string into a sized buffer
@ 2017-05-22 20:42 Karim Eshapa
0 siblings, 0 replies; only message in thread
From: Karim Eshapa @ 2017-05-22 20:42 UTC (permalink / raw)
To: realmz6; +Cc: adi-buildroot-devel, linux-kernel, Karim Eshapa
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-05-22 20:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 20:42 [PATCH] arch: blackfin: kernel: bfin_gpio: Use strlcpy to Copy a C-string into a sized buffer Karim Eshapa
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®