Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcrypt Ensure that the salt is always terminated prope...



details:   https://anonhg.NetBSD.org/src/rev/72e12720730e
branches:  trunk
changeset: 514776:72e12720730e
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Sep 10 12:33:25 2001 +0000

description:
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@localhost>.

diffstat:

 lib/libcrypt/md5crypt.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ba1f8b9e9178 -r 72e12720730e lib/libcrypt/md5crypt.c
--- a/lib/libcrypt/md5crypt.c   Mon Sep 10 11:18:41 2001 +0000
+++ b/lib/libcrypt/md5crypt.c   Mon Sep 10 12:33:25 2001 +0000
@@ -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 @@
 
        /* 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);



Home | Main Index | Thread Index | Old Index