diff options
author | sattdeepan.d <sattdeepan.d@samsung.com> | 2020-06-17 17:39:01 +0530 |
---|---|---|
committer | Seungha Son <seungha.son@samsung.com> | 2020-06-22 19:07:35 +0900 |
commit | f3f82c7fd5cf44e5ecd4cd304b08c88c1f7f1b98 (patch) | |
tree | 7f5740ebcfa986953fd57cd9c55ba52bd91f7ccf | |
parent | d65d04fabb5bc2336d24a44e15fd592a22be4ca7 (diff) | |
download | ttrace-f3f82c7fd5cf44e5ecd4cd304b08c88c1f7f1b98.tar.gz ttrace-f3f82c7fd5cf44e5ecd4cd304b08c88c1f7f1b98.tar.bz2 ttrace-f3f82c7fd5cf44e5ecd4cd304b08c88c1f7f1b98.zip |
svace security issue fixsubmit/tizen/20200623.023228accepted/tizen/unified/20200623.123920
Change-Id: I85b4c82a96e42d3a08acd1ec3f2f25742205aa4e
Signed-off-by: Seungha Son <seungha.son@samsung.com>
-rw-r--r-- | src/atrace_helper/main.cc | 2 | ||||
-rw-r--r-- | src/atrace_helper/procfs_utils.cc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/atrace_helper/main.cc b/src/atrace_helper/main.cc index 35c36b0..6079c00 100644 --- a/src/atrace_helper/main.cc +++ b/src/atrace_helper/main.cc @@ -108,7 +108,7 @@ int main(int argc, char** argv) { char tmp_file[PATH_MAX + 4]; if (dump_to_file) { unlink(out_file); - sprintf(tmp_file, "%s.tmp", out_file); + snprintf(tmp_file, PATH_MAX + 4, "%s.tmp", out_file); out_stream = fopen(tmp_file, "w"); CHECK(out_stream); } diff --git a/src/atrace_helper/procfs_utils.cc b/src/atrace_helper/procfs_utils.cc index bf1ee4a..5726a24 100644 --- a/src/atrace_helper/procfs_utils.cc +++ b/src/atrace_helper/procfs_utils.cc @@ -28,7 +28,7 @@ inline void ReadProcString(int pid, const char* path, char* buf, size_t size) { inline void ReadExePath(int pid, char* buf, size_t size) { char exe_path[64]; - sprintf(exe_path, "/proc/%d/exe", pid); + snprintf(exe_path, sizeof(exe_path), "/proc/%d/exe", pid); ssize_t res = readlink(exe_path, buf, size - 1); if (res >= 0) buf[res] = '\0'; @@ -74,13 +74,13 @@ void ReadProcessThreads(ProcessInfo* process) { return; char tasks_path[64]; - sprintf(tasks_path, "/proc/%d/task", process->pid); + snprintf(tasks_path, sizeof(tasks_path), "/proc/%d/task", process->pid); ForEachPidInProcPath(tasks_path, [process](int tid) { if (process->threads.count(tid)) return; ThreadInfo thread = { tid, "" }; char task_comm[64]; - sprintf(task_comm, "task/%d/comm", tid); + snprintf(task_comm, sizeof(task_comm), "task/%d/comm", tid); ReadProcString(process->pid, task_comm, thread.name, sizeof(thread.name)); if (thread.name[0] == '\0' && process->is_app) strcpy(thread.name, "UI Thread"); |