]> Git Repo - J-linux.git/commitdiff
tsacct: replace strncpy() with strscpy()
authorKees Cook <[email protected]>
Thu, 11 Jul 2024 17:13:09 +0000 (10:13 -0700)
committerAndrew Morton <[email protected]>
Fri, 12 Jul 2024 23:39:53 +0000 (16:39 -0700)
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
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]>
kernel/tsacct.c

index 4252f0645b9e38f7fbc4436a472ca703384a31a4..16b283f9d8314122723b1c8d5dc95529e71beaa3 100644 (file)
@@ -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);
 }
 
 
This page took 0.046585 seconds and 4 git commands to generate.