msm8974-common: gps: Fix for buffer overrun crash at copying nmea string

Add zero clearing of allocated nmea buffer to ensure
the nmea string is null terminated.

Change-Id: Ie36010a7d3eca16dabb3067ae891a94e4b63b10c
CRs-Fixed: 2041933
This commit is contained in:
Katz Yamada 2017-05-07 11:22:28 -07:00 committed by Kevin F. Haggerty
parent 98f5543b46
commit b3094b1fb9
No known key found for this signature in database
GPG Key ID: 6D95512933112729

View File

@ -893,9 +893,9 @@ inline void LocEngReportStatus::log() const {
// case LOC_ENG_MSG_REPORT_NMEA:
LocEngReportNmea::LocEngReportNmea(void* locEng,
const char* data, int len) :
LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
LocMsg(), mLocEng(locEng), mNmea(new char[len+1]), mLen(len)
{
memcpy((void*)mNmea, (void*)data, len);
strlcpy(mNmea, data, len+1);
locallog();
}
void LocEngReportNmea::proc() const {