Skip to content

Commit

Permalink
tsacct: replace strncpy() with strscpy()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kees authored and akpm00 committed Jul 12, 2024
1 parent e1fb743 commit 0fe2356
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/tsacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 0fe2356

Please sign in to comment.