summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt
diff options
context:
space:
mode:
authormillert <>2003-04-02 20:35:29 +0000
committermillert <>2003-04-02 20:35:29 +0000
commit1c0001600aef97c33c154150432dcdbdc86b0d75 (patch)
tree8aead65007b29527c35bafe40bf1932398d1d001 /src/lib/libc/crypt
parenta4d5807e4cbcec07efac4820cde9aa0f11a37c64 (diff)
downloadopenbsd-1c0001600aef97c33c154150432dcdbdc86b0d75.tar.gz
openbsd-1c0001600aef97c33c154150432dcdbdc86b0d75.tar.bz2
openbsd-1c0001600aef97c33c154150432dcdbdc86b0d75.zip
Use snprintf instead of a strcpy(), strncat() and strcat() sequence
deraadt@ OK
Diffstat (limited to 'src/lib/libc/crypt')
-rw-r--r--src/lib/libc/crypt/md5crypt.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libc/crypt/md5crypt.c b/src/lib/libc/crypt/md5crypt.c
index 56ab66fbb5..048858494c 100644
--- a/src/lib/libc/crypt/md5crypt.c
+++ b/src/lib/libc/crypt/md5crypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: md5crypt.c,v 1.10 2002/02/16 21:27:22 millert Exp $ */ 1/* $OpenBSD: md5crypt.c,v 1.11 2003/04/02 20:35:29 millert Exp $ */
2 2
3/* 3/*
4 * ---------------------------------------------------------------------------- 4 * ----------------------------------------------------------------------------
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#if defined(LIBC_SCCS) && !defined(lint) 15#if defined(LIBC_SCCS) && !defined(lint)
16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.10 2002/02/16 21:27:22 millert Exp $"; 16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.11 2003/04/02 20:35:29 millert Exp $";
17#endif /* LIBC_SCCS and not lint */ 17#endif /* LIBC_SCCS and not lint */
18 18
19#include <unistd.h> 19#include <unistd.h>
@@ -108,9 +108,8 @@ md5crypt(pw, salt)
108 MD5Update(&ctx, (const unsigned char *)pw, 1); 108 MD5Update(&ctx, (const unsigned char *)pw, 1);
109 109
110 /* Now make the output string */ 110 /* Now make the output string */
111 strcpy(passwd,(const char *)magic); 111 snprintf(passwd, sizeof(passwd), "%s%.*s$", (char *)magic,
112 strncat(passwd,(const char *)sp,sl); 112 sl, (const char *)sp);
113 strcat(passwd,"$");
114 113
115 MD5Final(final,&ctx); 114 MD5Final(final,&ctx);
116 115