summaryrefslogtreecommitdiff
path: root/utils/LocThread.cpp
diff options
context:
space:
mode:
authorSaurabh Srivastava <ssrivast@codeaurora.org>2016-04-06 02:01:30 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-04-08 03:25:02 -0700
commit5573c31749e12b387d20ac1a4a76b07b070cf830 (patch)
tree9abbeea750275724f113859010cead32b5e45379 /utils/LocThread.cpp
parent8f54f693ee413e3716ae4d18a67282404e4df4f7 (diff)
downloadgps-5573c31749e12b387d20ac1a4a76b07b070cf830.tar.gz
Adding fix for KW warning
Fix for buffer overflow possibility for the thread name passed in to pthread_setname_np() method. Change-Id: Id323dd058eddcf50d6fd9ec8908e9997b30c561b CRs-Fixed: 999457
Diffstat (limited to 'utils/LocThread.cpp')
-rw-r--r--utils/LocThread.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/utils/LocThread.cpp b/utils/LocThread.cpp
index 19bf101..a7fd1c8 100644
--- a/utils/LocThread.cpp
+++ b/utils/LocThread.cpp
@@ -84,9 +84,7 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
if (mThandle) {
// set thread name
char lname[16];
- int len = sizeof(lname) - 1;
- memcpy(lname, threadName, len);
- lname[len] = 0;
+ strlcpy(lname, threadName, sizeof(lname));
// set the thread name here
pthread_setname_np(mThandle, lname);