Module Name:    src
Committed By:   christos
Date:           Wed Dec 28 03:12:38 UTC 2011

Modified Files:
        src/lib/libcrypt: bcrypt.c

Log Message:
clamp length to 72 (73) characters.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libcrypt/bcrypt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcrypt/bcrypt.c
diff -u src/lib/libcrypt/bcrypt.c:1.14 src/lib/libcrypt/bcrypt.c:1.15
--- src/lib/libcrypt/bcrypt.c:1.14	Tue Dec 27 18:33:41 2011
+++ src/lib/libcrypt/bcrypt.c	Tue Dec 27 22:12:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcrypt.c,v 1.14 2011/12/27 23:33:41 christos Exp $	*/
+/*	$NetBSD: bcrypt.c,v 1.15 2011/12/28 03:12:38 christos Exp $	*/
 /*	$OpenBSD: bcrypt.c,v 1.16 2002/02/19 19:39:36 millert Exp $	*/
 
 /*
@@ -46,7 +46,7 @@
  *
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bcrypt.c,v 1.14 2011/12/27 23:33:41 christos Exp $");
+__RCSID("$NetBSD: bcrypt.c,v 1.15 2011/12/28 03:12:38 christos Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -269,9 +269,11 @@ __bcrypt(key, salt)
 	decode_base64(csalt, BCRYPT_MAXSALT, (const u_int8_t *)salt);
 	salt_len = BCRYPT_MAXSALT;
 	len = strlen(key);
-	if (len > 253)
-		return NULL;
-	key_len = (uint8_t)len + (minor >= 'a' ? 1 : 0);
+	if (len > 72)
+		key_len = 72;
+	else
+		key_len = (uint8_t)len;
+	key_len += minor >= 'a' ? 1 : 0;
 
 	/* Setting up S-Boxes and Subkeys */
 	Blowfish_initstate(&state);

Reply via email to