tsacct: Replace strncpy() with strscpy()
PATCH 1/1 tsacct: Replace strncpy() with strscpy()
Replace the deprecated[1] use of strncpy() in bacct_add_tsk(). Since this is UAPI, include trailing padding in the copy.
Signed-off-by Kees Cook <[email protected]>
---
Cc: Andrew Morton <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Peng Liu <[email protected]>
Cc: "Dr. Thomas Orgis" <[email protected]>
Cc: Ismael Luceno <[email protected]>
--- kernel/tsacct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/tsacct.c +1 -1
@@ -76,7 +76,7 @@ void bacct_add_tsk(struct user_namespace *user_ns, stats->ac_minflt = tsk->min_flt; stats->ac_majflt = tsk->maj_flt; -strncpy (stats->ac_comm, tsk->comm,sizeof (stats->ac_comm)); +strscpy_pad (stats->ac_comm, tsk->comm); }
Signature · 1 line
2.34.1