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
This commit is contained in:
Saurabh Srivastava 2016-04-06 02:01:30 +05:30 committed by Gerrit - the friendly Code Review server
parent 8f54f693ee
commit 5573c31749

View file

@ -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);