Skip to content

Commit

Permalink
fs/proc/kcore.c: using strlcpy() instead of strncpy()
Browse files Browse the repository at this point in the history
For NUL terminated string, set '\0' at the end.

Signed-off-by: Zhao Hongjiang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Zhao Hongjiang authored and torvalds committed Jul 3, 2013
1 parent 1d98a5f commit 30bc30d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/proc/kcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 30bc30d

Please sign in to comment.