* [PATCH] proc: kcore: using strlcpy instead of strncpy
@ 2013-06-20 11:01 Zhao Hongjiang
0 siblings, 0 replies; only message in thread
From: Zhao Hongjiang @ 2013-06-20 11:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: dhowells, ralf, dhillf, linux-kernel
for NUL terminated string, need alway set '\0' in the end.
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
---
fs/proc/kcore.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 0a22194..06ea155 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -408,7 +408,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
prpsinfo.pr_zomb = 0;
strcpy(prpsinfo.pr_fname, "vmlinux");
- strncpy(prpsinfo.pr_psargs, saved_command_line, ELF_PRARGSZ);
+ strlcpy(prpsinfo.pr_psargs, saved_command_line, sizeof(prpsinfo.pr_psargs));
nhdr->p_filesz += notesize(¬es[1]);
bufp = storenote(¬es[1], bufp);
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-06-20 11:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-20 11:01 [PATCH] proc: kcore: using strlcpy instead of strncpy Zhao Hongjiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox