summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Mertz <scott@cyngn.com>2016-03-30 10:27:31 -0700
committerScott Mertz <scott@cyngn.com>2016-03-30 10:28:03 -0700
commit40a38897b450093b61719015d8f8b6fa80f31595 (patch)
treee497077d9d31ab72c4eb9b903a40dd1810598ab3
parent26bc3e918e79909fed67ddca66045b9faf888c84 (diff)
downloadsystem_core-40a38897b450093b61719015d8f8b6fa80f31595.zip
system_core-40a38897b450093b61719015d8f8b6fa80f31595.tar.gz
system_core-40a38897b450093b61719015d8f8b6fa80f31595.tar.bz2
sched_policy: zero proc_name buffer before populating
The process name will be read into the buffer containing the proc name filepath. We need to reinitialize the buffer before reading into it. Change-Id: I67710819c895d3f9e2b0d486ab8a11f29f8318e8
-rw-r--r--libcutils/sched_policy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index aa4f39d..b302bef 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -138,6 +138,7 @@ static void __initialize(void) {
sprintf(proc_name, "/proc/%d/cmdline", ptid);
pfd = open(proc_name, O_RDONLY);
+ memset(proc_name, 0, sizeof(proc_name));
if (pfd > 0) {
read(pfd, proc_name, sizeof(proc_name) - 1);
close(pfd);