[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240711171308.work.995-kees@kernel.org>
Date: Thu, 11 Jul 2024 10:13:09 -0700
From: Kees Cook <kees@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <kees@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Peng Liu <liupeng256@...wei.com>,
"Dr. Thomas Orgis" <thomas.orgis@...-hamburg.de>,
Ismael Luceno <ismael@...ev.co.uk>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: [PATCH] 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]
Signed-off-by: Kees Cook <kees@...nel.org>
---
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Peng Liu <liupeng256@...wei.com>
Cc: "Dr. Thomas Orgis" <thomas.orgis@...-hamburg.de>
Cc: Ismael Luceno <ismael@...ev.co.uk>
---
kernel/tsacct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
--
2.34.1
Powered by blists - more mailing lists