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/crypt/crypt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/lib/libc/crypt/crypt.c') diff --git a/src/lib/libc/crypt/crypt.c b/src/lib/libc/crypt/crypt.c index 8fd319a4f3..d1a342c178 100644 --- a/src/lib/libc/crypt/crypt.c +++ b/src/lib/libc/crypt/crypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypt.c,v 1.13 1998/03/22 19:01:18 niklas Exp $ */ +/* $OpenBSD: crypt.c,v 1.14 2001/06/27 00:58:53 lebel Exp $ */ /* * FreeSec: libcrypt @@ -52,7 +52,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: crypt.c,v 1.13 1998/03/22 19:01:18 niklas Exp $"; +static char rcsid[] = "$OpenBSD: crypt.c,v 1.14 2001/06/27 00:58:53 lebel Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -650,7 +650,7 @@ crypt(key, setting) if (des_setkey((u_char *) keybuf)) return(NULL); } - strncpy((char *)output, setting, 9); + strlcpy((char *)output, setting, 10); /* * Double check that we weren't given a short setting. @@ -659,7 +659,6 @@ crypt(key, setting) * Just make sure the output string doesn't have an extra * NUL in it. */ - output[9] = '\0'; p = output + strlen((const char *)output); } else { /* -- cgit v1.2.3-55-g6feb