Skip to contentSkip to conversation

trace_event: using strlcpy instead of strncpy

PATCH New Zhao Hongjiang 1 participant 1 message Jun 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace_event: using strlcpy instead of strncpy

for NUL terminated string, need alway set '\0' in the end.

---
 samples/trace_events/trace-events-sample.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
samples/trace_events/trace-events-sample.h +1 -1
index 6af3732..900f512 100644
@@ -86,7 +86,7 @@ TRACE_EVENT(foo_bar,
 	),
 
 	TP_fast_assign(
-		strncpy(__entry->foo, foo, 10);
+		strlcpy(__entry->foo, foo, 10);
 		__entry->bar	= bar;
 	),
 
Signature · 1 line
1.7.1