diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-10-28 21:18:46 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-23 12:15:05 -0800 |
commit | 6e6d732bac3c21cb85f8e998908f9b393630e5f8 (patch) | |
tree | be0fb5e9e8f4e10af141e061f35e6f62b06d3181 /os/access.c | |
parent | e189dbb3e57d30eb96034d4ce9544ce7a93a371e (diff) |
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>
Diffstat (limited to 'os/access.c')
-rw-r--r-- | os/access.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/os/access.c b/os/access.c index f31626d96..159894007 100644 --- a/os/access.c +++ b/os/access.c @@ -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 */ |