https://github.com/torvalds/linux
Revision cf4d418e653afc84c9c873236033e06be5d58f1c authored by Arnd Bergmann on 28 March 2018, 14:09:10 UTC, committed by Steven Rostedt (VMware) on 03 July 2018, 22:14:39 UTC
'err' is used as a NUL-terminated string, but using strncpy() with the length
equal to the buffer size may result in lack of the termination:

kernel/trace/trace_events_hist.c: In function 'hist_err_event':
kernel/trace/trace_events_hist.c:396:3: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
   strncpy(err, var, MAX_FILTER_STR_VAL);

This changes it to use the safer strscpy() instead.

Link: http://lkml.kernel.org/r/20180328140920.2842153-1-arnd@arndb.de

Cc: stable@vger.kernel.org
Fixes: f404da6e1d46 ("tracing: Add 'last error' error facility for hist triggers")
Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 021c917
History
Tip revision: cf4d418e653afc84c9c873236033e06be5d58f1c authored by Arnd Bergmann on 28 March 2018, 14:09:10 UTC
tracing: Avoid string overflow
Tip revision: cf4d418

back to top