From: Zhao Hongjiang Date: Wed, 3 Jul 2013 22:08:28 +0000 (-0700) Subject: fs/proc/kcore.c: using strlcpy() instead of strncpy() X-Git-Tag: v3.11-rc1~99^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=30bc30df102b2d0c003d93477e04b97e6c528573;p=platform%2Fupstream%2Fkernel-adaptation-pc.git fs/proc/kcore.c: using strlcpy() instead of strncpy() For NUL terminated string, set '\0' at the end. Signed-off-by: Zhao Hongjiang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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);