fs/proc/kcore.c: using strlcpy() instead of strncpy()
authorZhao Hongjiang <zhaohongjiang@huawei.com>
Wed, 3 Jul 2013 22:08:28 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:08:02 +0000 (16:08 -0700)
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>
fs/proc/kcore.c

index 0a22194e5d586f2dc3e7488702475746ed5f9da4..06ea155e1a590530d0c16ee964107bcf54756995 100644 (file)
@@ -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(&notes[1]);
        bufp = storenote(&notes[1], bufp);