Convert strncpy/strncat to strlcpy/strlcat

As long as we're carrying around a compatibility copy in os/strl*.c,
might as well use them.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Alan Coopersmith 2011-10-28 21:18:46 -07:00
commit 6e6d732bac
13 changed files with 21 additions and 33 deletions

View file

@ -1756,8 +1756,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
if (siAddrLen >= sizeof(hostname))
return FALSE;
strncpy(hostname, siAddr, siAddrLen);
hostname[siAddrLen] = '\0';
strlcpy(hostname, siAddr, siAddrLen + 1);
if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) {
for (a = addresses ; a != NULL ; a = a->ai_next) {
@ -1786,8 +1785,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
if (siAddrLen >= sizeof(hostname))
return FALSE;
strncpy(hostname, siAddr, siAddrLen);
hostname[siAddrLen] = '\0';
strlcpy(hostname, siAddr, siAddrLen + 1);
if ((hp = _XGethostbyname(hostname, hparams)) != NULL) {
#ifdef h_addr /* new 4.3bsd version of gethostent */