diff --git a/gps/loc_api/libloc_api_50001/loc_eng.cpp b/gps/loc_api/libloc_api_50001/loc_eng.cpp index af97c51..0aa1c8b 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng.cpp @@ -891,9 +891,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 {