Replace unsafe functions

Replace strncpy with strlcpy

Change-Id: Iade6b1201db75fb15da37431183cb372cd1ad41a
CRs-fixed: 2298929
This commit is contained in:
Mike Cailean 2018-08-17 10:29:48 -07:00
parent 4088ca58bc
commit 4599ab400c

View file

@ -631,7 +631,7 @@ GnssAdapter::setSuplHostServer(const char* server, int port, LocServerType type)
if (LOC_AGPS_SUPL_SERVER == type) {
int nCharsToCopy = strlen(server) < MAX_SUPL_SERVER_URL_LENGTH ?
strlen(server) : (MAX_SUPL_SERVER_URL_LENGTH - 1);
strncpy(ContextBase::mGps_conf.SUPL_HOST, server, nCharsToCopy);
strlcpy(ContextBase::mGps_conf.SUPL_HOST, server, nCharsToCopy);
ContextBase::mGps_conf.SUPL_HOST[nCharsToCopy] = '\0';
ContextBase::mGps_conf.SUPL_PORT = port;
}