Skip to content

Commit 0fe2356

Browse files
keesakpm00
authored andcommitted
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: KSPP/linux#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>
1 parent e1fb743 commit 0fe2356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/tsacct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void bacct_add_tsk(struct user_namespace *user_ns,
7676
stats->ac_minflt = tsk->min_flt;
7777
stats->ac_majflt = tsk->maj_flt;
7878

79-
strncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm));
79+
strscpy_pad(stats->ac_comm, tsk->comm);
8080
}
8181

8282

0 commit comments

Comments
 (0)