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
2efdd808f9
commit
3138fafbcd
@ -891,9 +891,9 @@ inline void LocEngReportStatus::log() const {
|
|||||||
// case LOC_ENG_MSG_REPORT_NMEA:
|
// case LOC_ENG_MSG_REPORT_NMEA:
|
||||||
LocEngReportNmea::LocEngReportNmea(void* locEng,
|
LocEngReportNmea::LocEngReportNmea(void* locEng,
|
||||||
const char* data, int len) :
|
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();
|
locallog();
|
||||||
}
|
}
|
||||||
void LocEngReportNmea::proc() const {
|
void LocEngReportNmea::proc() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user