summaryrefslogtreecommitdiff
path: root/lib/libcrypt
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2001-09-10 12:33:25 +0000
committerad <ad@NetBSD.org>2001-09-10 12:33:25 +0000
commite5afda7b98fc82fbacee319c8a17eacad5111a21 (patch)
treebdffaf20680006d32d157c1eab4368182249ca8d /lib/libcrypt
parent2db48f4c88b670c26268d20e6ecea17889a675c1 (diff)
Ensure that the salt is always terminated properly with '$'. Makes Cyrus'
pwcheck (which either modifies the buffer or was passing bad password strings) happy. Noted by Cillian Sharkey <cns@redbrick.dcu.ie>.
Diffstat (limited to 'lib/libcrypt')
-rw-r--r--lib/libcrypt/md5crypt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypt/md5crypt.c b/lib/libcrypt/md5crypt.c
index 73a1af58284..8b9617620fd 100644
--- a/lib/libcrypt/md5crypt.c
+++ b/lib/libcrypt/md5crypt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: md5crypt.c,v 1.3 2000/12/03 13:01:37 ad Exp $ */
+/* $NetBSD: md5crypt.c,v 1.4 2001/09/10 12:33:25 ad Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: md5crypt.c,v 1.3 2000/12/03 13:01:37 ad Exp $");
+__RCSID("$NetBSD: md5crypt.c,v 1.4 2001/09/10 12:33:25 ad Exp $");
#endif /* not lint */
#include <unistd.h>
@@ -107,7 +107,7 @@ __md5crypt(const char *pw, const char *salt)
/* Now make the output string */
memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
- strncpy(passwd + MD5_MAGIC_LEN, sp, sl);
+ strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1);
strcat(passwd, "$");
MD5Final(final, &ctx);