Skip to content

Commit 721d28f

Browse files
keeshdeller
authored andcommitted
parisc: Replace strlcpy() with strscpy()
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destination string. In an effort to remove strlcpy() completely[2], replace strlcpy() here with strscpy(). Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1] Link: KSPP#89 [2] Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: Azeem Shaikh <azeemshaikh38@gmail.com> Cc: linux-parisc@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent b85ea95 commit 721d28f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/parisc/kernel/processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ show_cpuinfo (struct seq_file *m, void *v)
383383
char cpu_name[60], *p;
384384

385385
/* strip PA path from CPU name to not confuse lscpu */
386-
strlcpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
386+
strscpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
387387
p = strrchr(cpu_name, '[');
388388
if (p)
389389
*(--p) = 0;

0 commit comments

Comments
 (0)