From ba6f70d7550cc513151c4bb719659d4775a9efff Mon Sep 17 00:00:00 2001 From: lebel <> Date: Wed, 27 Jun 2001 00:58:56 +0000 Subject: use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok. --- src/lib/libc/net/ethers.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/lib/libc/net/ethers.c') diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index 1124e43253..2c8328a9ba 100644 --- a/src/lib/libc/net/ethers.c +++ b/src/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 @@ -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 @@ -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: -- cgit v1.2.3-55-g6feb