Source-Changes-HG archive

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

[src/trunk]: src/lib/libcrypt clamp length to 72 (73) characters.



details:   https://anonhg.NetBSD.org/src/rev/21bafb6dff34
branches:  trunk
changeset: 772292:21bafb6dff34
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 28 03:12:38 2011 +0000

description:
clamp length to 72 (73) characters.

diffstat:

 lib/libcrypt/bcrypt.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 3db7e5ab5f6f -r 21bafb6dff34 lib/libcrypt/bcrypt.c
--- a/lib/libcrypt/bcrypt.c     Wed Dec 28 02:14:57 2011 +0000
+++ b/lib/libcrypt/bcrypt.c     Wed Dec 28 03:12:38 2011 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index