mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 14:17:28 +07:00
tracing: Avoid string overflow
'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: f404da6e1d
("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>
This commit is contained in:
parent
021c91791a
commit
cf4d418e65
@ -393,7 +393,7 @@ static void hist_err_event(char *str, char *system, char *event, char *var)
|
||||
else if (system)
|
||||
snprintf(err, MAX_FILTER_STR_VAL, "%s.%s", system, event);
|
||||
else
|
||||
strncpy(err, var, MAX_FILTER_STR_VAL);
|
||||
strscpy(err, var, MAX_FILTER_STR_VAL);
|
||||
|
||||
hist_err(str, err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user