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#90 [1] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]> Cc: "Dr. Thomas Orgis" <[email protected]> Cc: Eric W. Biederman <[email protected]> Cc: Ismael Luceno <[email protected]> Cc: Peng Liu <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
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)