From 6b9221934a3b9917502477cf69a3cdc1fa82cc7c Mon Sep 17 00:00:00 2001 From: Saurabh Srivastava Date: Wed, 6 Apr 2016 02:01:30 +0530 Subject: [PATCH] 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 --- gps/utils/LocThread.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gps/utils/LocThread.cpp b/gps/utils/LocThread.cpp index 19bf101..a7fd1c8 100644 --- a/gps/utils/LocThread.cpp +++ b/gps/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);