]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs/proc/kcore.c: using strlcpy() instead of strncpy()
authorZhao Hongjiang <zhaohongjiang@huawei.com>
Thu, 27 Jun 2013 23:53:55 +0000 (09:53 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:38:57 +0000 (16:38 +1000)
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>
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);