Skip to contentSkip to conversation

arch: blackfin: kernel: bfin_gpio: Use strlcpy to Copy a C-string into a sized buffer

PATCH New Karim Eshapa 1 participant 1 message May 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch: blackfin: kernel: bfin_gpio: Use strlcpy to Copy a C-string into a sized buffer

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

---
 arch/blackfin/kernel/bfin_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/blackfin/kernel/bfin_gpio.c +1 -1
index c5d3128..49fca59 100644
@@ -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;
 	}
Signature · 1 line
2.7.4