linux-stable/samples/trace_events
Kees Cook 40b2519d75 samples: Replace strlcpy() with strscpy()
strlcpy() reads the entire source buffer first. This read may exceed
the destination size limit. This is both inefficient and can lead
to linear read overflows if a source string is not NUL-terminated[1].
Additionally, it returns the size of the source string, not the
resulting size of the destination string. In an effort to remove strlcpy()
completely[2], replace strlcpy() here with strscpy().

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1]
Link: https://github.com/KSPP/linux/issues/89 [2]
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Geliang Tang <geliang.tang@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20231116191510.work.550-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
2023-11-30 12:20:53 -08:00
..
Makefile tracing: Add TRACE_CUSTOM_EVENT() macro 2022-03-11 11:49:24 -05:00
trace-events-sample.c tracing: Add __cpumask to denote a trace event field that is a cpumask_t 2022-11-23 19:08:30 -05:00
trace-events-sample.h samples: Replace strlcpy() with strscpy() 2023-11-30 12:20:53 -08:00
trace_custom_sched.c tracing: Add TRACE_CUSTOM_EVENT() macro 2022-03-11 11:49:24 -05:00
trace_custom_sched.h sched/tracing: Append prev_state to tp args instead 2022-05-12 00:37:11 +02:00