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:
parent
98f5543b46
commit
b3094b1fb9
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user