trace: resolve stack corruption due to string copy

Strcpy has no limit on string being copied which causes
stack corruption leading to kernel panic. Use strlcpy to
resolve the issue by providing length of string to be copied.

CRs-fixed: 1048480
Change-Id: Ib290b25f7e0ff96927b8530e5c078869441d409f
Signed-off-by: Amey Telawane <ameyt@codeaurora.org>
This commit is contained in:
Amey Telawane 2016-08-01 16:50:43 +05:30 committed by Gerrit - the friendly Code Review server
parent 66986ce619
commit 93856cb815
1 changed files with 1 additions and 1 deletions

View File

@ -1480,7 +1480,7 @@ void trace_find_cmdline(int pid, char comm[])
arch_spin_lock(&trace_cmdline_lock);
map = map_pid_to_cmdline[pid];
if (map != NO_CMDLINE_MAP)
strcpy(comm, saved_cmdlines[map]);
strlcpy(comm, saved_cmdlines[map], TASK_COMM_LEN-1);
else
strcpy(comm, "<...>");