Skip to contentSkip to conversation

arch: arm: mach-msm: using strlcpy instead of strncpy

PATCH New Chen Gang 1 participant 1 message May 26, 2013

Subsystems (3)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 arch: arm: mach-msm: using strlcpy instead of strncpy

For NULL terminated string, need always be sure of ended by zero.

Or the next 'ptr' in 'for' looping may cause issue.

---
 arch/arm/mach-msm/clock-debug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-msm/clock-debug.c +1 -1
index 4886404..b0fbdf1 100644
@@ -104,7 +104,7 @@ int __init clock_debug_add(struct clk *clock)
 	if (!debugfs_base)
 		return -ENOMEM;
 
-	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);
 
Signature · 1 line
1.7.7.6