From 8b5c9a764c1eae70685b6fe60d7b11bd75b048c5 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 2 Jun 2004 20:20:02 +0000 Subject: [PATCH] ITS#3169: fix safety checks to allow for varying salt lengths --- libraries/liblutil/passwd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 7f133a8367..3ce1ae9757 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -459,9 +459,8 @@ static int chk_ssha1( int rc; unsigned char *orig_pass = NULL; - /* safety check */ - if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) < - sizeof(SHA1digest)+SALT_SIZE) { + /* safety check -- must have some salt */ + if (LUTIL_BASE64_DECODE_LEN(passwd->bv_len) <= sizeof(SHA1digest)) { return LUTIL_PASSWD_ERR; } @@ -473,7 +472,8 @@ static int chk_ssha1( rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len); - if (rc < (int)(sizeof(SHA1digest)+SALT_SIZE)) { + /* safety check -- must have some salt */ + if (rc <= (int)(sizeof(SHA1digest))) { ber_memfree(orig_pass); return LUTIL_PASSWD_ERR; } -- 2.39.5