From: Zhao Hongjiang <zhaohongjiang@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <dhowells@redhat.com>, <ralf@linux-mips.org>, <dhillf@gmail.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] proc: kcore: using strlcpy instead of strncpy
Date: Thu, 20 Jun 2013 19:01:42 +0800 [thread overview]
Message-ID: <51C2E116.3030901@huawei.com> (raw)
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
reply other threads:[~2013-06-20 11:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C2E116.3030901@huawei.com \
--to=zhaohongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dhillf@gmail.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox