summaryrefslogtreecommitdiffstats
path: root/kernel/tsacct.c
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-07-11 19:13:09 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-07-13 01:39:53 +0200
commit0fe2356434e157b3952ff4dbdfe0a96070ddcaa2 (patch)
tree3694562342d19f39826486979c7c34bf77a1338b /kernel/tsacct.c
parentlib/bch.c: use swap() to improve code (diff)
downloadlinux-0fe2356434e157b3952ff4dbdfe0a96070ddcaa2.tar.xz
linux-0fe2356434e157b3952ff4dbdfe0a96070ddcaa2.zip
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. Link: https://github.com/KSPP/linux/issues/90 [1] Link: https://lkml.kernel.org/r/20240711171308.work.995-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org> Cc: "Dr. Thomas Orgis" <thomas.orgis@uni-hamburg.de> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Ismael Luceno <ismael@iodev.co.uk> Cc: Peng Liu <liupeng256@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel/tsacct.c')
-rw-r--r--kernel/tsacct.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 4252f0645b9e..16b283f9d831 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -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);
}