diff options
author | Kees Cook <[email protected]> | 2024-07-11 10:13:09 -0700 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-07-12 16:39:53 -0700 |
commit | 0fe2356434e157b3952ff4dbdfe0a96070ddcaa2 (patch) | |
tree | 3694562342d19f39826486979c7c34bf77a1338b | |
parent | e1fb7430fcb00431087fc1c088ec9e8737cf6c7d (diff) |
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/[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]>
-rw-r--r-- | kernel/tsacct.c | 2 |
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); } |