diff options
author | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
---|---|---|
committer | lebel <lebel@cvs.openbsd.org> | 2001-06-27 00:58:58 +0000 |
commit | 8af9ac2691950c45385aecf7c502a16c3c11db86 (patch) | |
tree | 2b4161da48e1261faa9895ae08bd1fcdf3be38a3 /lib/libc/net/ethers.c | |
parent | c5355883f033c52fa97b73febb89e80adf21cbbd (diff) |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'lib/libc/net/ethers.c')
-rw-r--r-- | lib/libc/net/ethers.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/net/ethers.c b/lib/libc/net/ethers.c index 1124e432534..2c8328a9ba0 100644 --- a/lib/libc/net/ethers.c +++ b/lib/libc/net/ethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ethers.c,v 1.11 2000/08/22 19:04:41 deraadt Exp $ */ +/* $OpenBSD: ethers.c,v 1.12 2001/06/27 00:58:54 lebel Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ethers.c,v 1.11 2000/08/22 19:04:41 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ethers.c,v 1.12 2001/06/27 00:58:54 lebel Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -263,8 +263,7 @@ ether_line(line, e, hostname) n = strcspn(p, " \t\n"); if (n >= MAXHOSTNAMELEN) goto bad; - (void)strncpy(hostname, p, n); - hostname[n] = '\0'; + strlcpy(hostname, p, n + 1); return (0); bad: |