Commit d8fae2f6 authored by Zhao Hongjiang's avatar Zhao Hongjiang Committed by Steven Rostedt
Browse files

tracing: Change trace event sample to use strlcpy instead of strncpy

Strings should be copied with strlcpy instead of strncpy when they will
later be printed via %s. This guarantees that they terminate with a
NUL '\0' character and do not run pass the end of the allocated string.

This is only for sample code, but it should stil represent a good
role model.


Signed-off-by: default avatarZhao Hongjiang <>
Signed-off-by: default avatarSteven Rostedt <>
parent 9674b2fa
......@@ -87,7 +87,7 @@ TRACE_EVENT(foo_bar,
strncpy(__entry->foo, foo, 10);
strlcpy(__entry->foo, foo, 10);
__entry->bar = bar;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment