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
This commit is contained in:
Dante Russo 2013-11-12 15:49:32 -08:00
parent d32cd2946d
commit a0c2f679ee

View file

@ -875,6 +875,7 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
LocMsg(), mLocEng(locEng), mMaxLen(maxlength), LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
mServers(new char[3*(mMaxLen+1)]) mServers(new char[3*(mMaxLen+1)])
{ {
memset(mServers, 0, 3*(mMaxLen+1));
strlcpy(mServers, url1, mMaxLen); strlcpy(mServers, url1, mMaxLen);
strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen); strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen);
strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen); strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen);