Skip to content

Commit 30bc30d

Browse files
Zhao Hongjiangtorvalds
authored andcommitted
fs/proc/kcore.c: using strlcpy() instead of strncpy()
For NUL terminated string, set '\0' at the end. Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1d98a5f commit 30bc30d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/proc/kcore.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
408408
prpsinfo.pr_zomb = 0;
409409

410410
strcpy(prpsinfo.pr_fname, "vmlinux");
411-
strncpy(prpsinfo.pr_psargs, saved_command_line, ELF_PRARGSZ);
411+
strlcpy(prpsinfo.pr_psargs, saved_command_line, sizeof(prpsinfo.pr_psargs));
412412

413413
nhdr->p_filesz += notesize(&notes[1]);
414414
bufp = storenote(&notes[1], bufp);

0 commit comments

Comments
 (0)