From a0c2f679eebc94ae9da524f8eb5f3107f63ea990 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Tue, 12 Nov 2013 15:49:32 -0800 Subject: [PATCH] Memset the xtra url to assure null termination Fixes a potential crash in jni layer caused by invalid characters in the string. CRs-fixed: 555829 Change-Id: I03ae100c4b7e65c95bac5841fcf00b27e2940741 --- loc_api/libloc_api_50001/loc_eng.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 5cf90872..1c2bac5a 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -875,6 +875,7 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng, LocMsg(), mLocEng(locEng), mMaxLen(maxlength), mServers(new char[3*(mMaxLen+1)]) { + memset(mServers, 0, 3*(mMaxLen+1)); strlcpy(mServers, url1, mMaxLen); strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen); strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen);