提交 06f43d66 编写于 作者: F Frederic Weisbecker

ftrace: Copy ftrace_graph_filter boot param using strlcpy

We are using strncpy in the wrong way to copy the ftrace_graph_filter
boot param because we pass the buffer size instead of the max string
size it can contain (buffer size - 1). The end result might not be
NULL terminated as we are abusing the max string size.

Lets use strlcpy() instead.
Reported-by: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
上级 459c6d15
...@@ -2293,7 +2293,7 @@ __setup("ftrace_filter=", set_ftrace_filter); ...@@ -2293,7 +2293,7 @@ __setup("ftrace_filter=", set_ftrace_filter);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static int __init set_graph_function(char *str) static int __init set_graph_function(char *str)
{ {
strncpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE); strlcpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);
return 1; return 1;
} }
__setup("ftrace_graph_filter=", set_graph_function); __setup("ftrace_graph_filter=", set_graph_function);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册