From 6e6d732bac3c21cb85f8e998908f9b393630e5f8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 28 Oct 2011 21:18:46 -0700 Subject: 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 Reviewed-by: Jeremy Huddleston --- os/access.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'os/access.c') 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 */ -- cgit v1.2.3