$OpenBSD: patch-src_unix_gsocket_c,v 1.1.1.1 2004/07/16 21:01:36 todd Exp $ --- src/unix/gsocket.c.orig Fri Sep 6 06:49:18 2002 +++ src/unix/gsocket.c Wed Apr 30 09:52:24 2003 @@ -1601,7 +1601,7 @@ GSocketError GAddress_INET_GetHostName(G return GSOCK_NOHOST; } - strncpy(hostname, he->h_name, sbuf); + strlcpy(hostname, he->h_name, sbuf); return GSOCK_NOERROR; } @@ -1664,8 +1664,7 @@ GSocketError GAddress_UNIX_SetPath(GAddr CHECK_ADDRESS(address, UNIX); addr = ((struct sockaddr_un *)address->m_addr); - strncpy(addr->sun_path, path, UNIX_SOCK_PATHLEN); - addr->sun_path[UNIX_SOCK_PATHLEN - 1] = '\0'; + strlcpy(addr->sun_path, path, UNIX_SOCK_PATHLEN); return GSOCK_NOERROR; } @@ -1679,7 +1678,7 @@ GSocketError GAddress_UNIX_GetPath(GAddr addr = (struct sockaddr_un *)address->m_addr; - strncpy(path, addr->sun_path, sbuf); + strlcpy(path, addr->sun_path, sbuf); return GSOCK_NOERROR; }