diff options
author | lebel <> | 2001-06-27 00:58:56 +0000 |
---|---|---|
committer | lebel <> | 2001-06-27 00:58:56 +0000 |
commit | ba6f70d7550cc513151c4bb719659d4775a9efff (patch) | |
tree | 267e8c115af6744d1fab5a015c06458ba2befdab /src/lib/libc/crypt | |
parent | c18bed276b8f6877a6111a6c03185f0025220031 (diff) | |
download | openbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.tar.gz openbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.tar.bz2 openbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.zip |
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'src/lib/libc/crypt')
-rw-r--r-- | src/lib/libc/crypt/crypt.c | 7 |
1 files changed, 3 insertions, 4 deletions
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 @@ | |||
1 | /* $OpenBSD: crypt.c,v 1.13 1998/03/22 19:01:18 niklas Exp $ */ | 1 | /* $OpenBSD: crypt.c,v 1.14 2001/06/27 00:58:53 lebel Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * FreeSec: libcrypt | 4 | * FreeSec: libcrypt |
@@ -52,7 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | #if defined(LIBC_SCCS) && !defined(lint) | 54 | #if defined(LIBC_SCCS) && !defined(lint) |
55 | static char rcsid[] = "$OpenBSD: crypt.c,v 1.13 1998/03/22 19:01:18 niklas Exp $"; | 55 | static char rcsid[] = "$OpenBSD: crypt.c,v 1.14 2001/06/27 00:58:53 lebel Exp $"; |
56 | #endif /* LIBC_SCCS and not lint */ | 56 | #endif /* LIBC_SCCS and not lint */ |
57 | 57 | ||
58 | #include <sys/types.h> | 58 | #include <sys/types.h> |
@@ -650,7 +650,7 @@ crypt(key, setting) | |||
650 | if (des_setkey((u_char *) keybuf)) | 650 | if (des_setkey((u_char *) keybuf)) |
651 | return(NULL); | 651 | return(NULL); |
652 | } | 652 | } |
653 | strncpy((char *)output, setting, 9); | 653 | strlcpy((char *)output, setting, 10); |
654 | 654 | ||
655 | /* | 655 | /* |
656 | * Double check that we weren't given a short setting. | 656 | * Double check that we weren't given a short setting. |
@@ -659,7 +659,6 @@ crypt(key, setting) | |||
659 | * Just make sure the output string doesn't have an extra | 659 | * Just make sure the output string doesn't have an extra |
660 | * NUL in it. | 660 | * NUL in it. |
661 | */ | 661 | */ |
662 | output[9] = '\0'; | ||
663 | p = output + strlen((const char *)output); | 662 | p = output + strlen((const char *)output); |
664 | } else { | 663 | } else { |
665 | /* | 664 | /* |