msm8974-common: gps: 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 Kevin F. Haggerty
parent e2e1b9d26a
commit 6b9221934a
No known key found for this signature in database
GPG Key ID: 6D95512933112729

View File

@ -84,9 +84,7 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
if (mThandle) { if (mThandle) {
// set thread name // set thread name
char lname[16]; char lname[16];
int len = sizeof(lname) - 1; strlcpy(lname, threadName, sizeof(lname));
memcpy(lname, threadName, len);
lname[len] = 0;
// set the thread name here // set the thread name here
pthread_setname_np(mThandle, lname); pthread_setname_np(mThandle, lname);